Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornhauge2011-02-04 20:50:10 +0000
committernhauge2011-02-04 20:50:10 +0000
commitf9c4be66f9deff892b4558e82208694bf0ec225a (patch)
tree3f2ae5e639e887ced2d78a3d8e4ae848818bc9f6 /jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal
parent876575b8400145f9a437b724217331594d2ae651 (diff)
downloadwebtools.dali-201102050000.tar.gz
webtools.dali-201102050000.tar.xz
webtools.dali-201102050000.zip
This commit was manufactured by cvs2svn to create tag 'v201102050000'.v201102050000
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal')
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefinitionProvider.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java402
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaNode.java223
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaPlatformProvider.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java1955
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationDefinitionProvider.java161
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatform.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformFactory.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformProvider.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JarResourceModelProvider.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaPackageInfoResourceModelProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaResourceModelProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformTester.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaTester.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/OrmResourceModelProvider.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/PersistenceResourceModelProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ProjectAdapterFactory.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractJpaContextNode.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractXmlContextNode.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AttributeMappingTools.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseJoinColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/ContextContainerTools.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/EntityTextRangeResolver.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JoinColumnTextRangeResolver.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JptValidator.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java432
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/NamedColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/OverrideTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributePropertyTester.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TableTextRangeResolver.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTools.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java319
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java361
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java319
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java383
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMappingDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java1816
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaGenerator.java225
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java476
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java348
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJpaContextNode.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMapping.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMapping.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappingRelationship.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java780
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java292
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java215
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java816
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java722
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java231
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java347
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java584
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java276
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMappingDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualBaseColumn.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualNamedColumn.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualOverride.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualReferenceTable.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualTable.java315
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToManyRelationship.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToOneRelationship.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java262
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java216
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyRelationship.java272
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToOneRelationship.java300
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java249
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java385
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVirtualJoinTable.java333
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBaseColumnTextRangeResolver.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityDefinition.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumnTextRangeResolver.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassDefinition.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumnTextRangeResolver.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOverrideTextRangeResolver.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTableTextRangeResolver.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMappingTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingDefinition.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractEntityMappings.java1016
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java419
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java302
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java328
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java425
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddable.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java2285
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmGenerator.java224
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java508
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java332
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToManyMapping.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToOneMapping.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappedSuperclass.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappingRelationship.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java813
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java287
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyMapping.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToOneMapping.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmQuery.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java418
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSequenceGenerator.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTable.java541
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java482
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java325
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualTable.java314
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java386
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlDefinition.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdClassReference.java323
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyRelationship.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToOneRelationship.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java223
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyRelationship.java241
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneRelationship.java263
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java209
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java344
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualJoinTable.java333
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java333
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java272
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBasicMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddableDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmIdMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToManyMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToOneMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToManyMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToOneMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOverrideTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTableTextRangeResolver.java40
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTransientMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmVersionMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java430
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualOrmPersistentAttribute.java585
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java384
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java344
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java2404
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java529
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/FacetTools.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetActionDelegate.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProperties.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java715
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProperties.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetUninstallDelegate.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDelegate.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/RuntimeChangedListener.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaDataSource.java230
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFactory.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFile.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaProject.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractJoinTableValidator.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractNamedColumnValidator.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java74
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java618
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTableValidator.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTypeMappingValidator.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java267
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java269
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideValidator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideColumnValidator.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideValidator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseColumnTableValidator.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseJoinColumnValidator.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/DiscriminatorColumnValidator.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericPersistentAttributeValidator.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java294
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericTypeMappingValidator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/InverseJoinColumnValidator.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinColumnValidator.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableValidator.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyColumnValidator.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/NamedColumnValidator.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/OverrideValidator.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTableValidator.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/TableValidator.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/AbstractJavaConverter.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java587
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJarFile.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java122
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaBasicMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaCascade.java255
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaColumn.java221
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java182
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddable.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java164
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java284
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java220
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java283
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaIdMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java212
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java496
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java49
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedQuery.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java486
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java247
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java208
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java370
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryHint.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaReferenceTable.java317
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java400
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java567
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTransientMapping.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVersionMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java335
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaConverter.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java166
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmConverter.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmOverride.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java472
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericEntityMappings.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java201
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmCascade.java303
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java261
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmIdMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java511
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmLobConverter.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java85
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java452
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java249
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java344
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java1195
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java366
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryHint.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java418
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTable.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java440
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXml.java281
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/NullOrmConverter.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericClassRef.java378
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericJarFileRef.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericMappingFileRef.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java302
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java251
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformFactory.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformProvider.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericMetamodelSynchronizer.java432
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/CollectionTableValidator.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/OrderColumnValidator.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/SimpleMetamodelField.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java1530
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java178
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java361
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java250
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaCacheable2_0.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java276
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java1592
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java282
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java90
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java337
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java137
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java272
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java222
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java244
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/LegacyJpaLibraryProviderDetector.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/GenericJpaUserLibraryValidator.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java157
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProperties.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java280
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProperties.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationOperation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformDescriptionImpl.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformGroupDescriptionImpl.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformManagerImpl.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/prefs/JpaPreferenceInitializer.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java288
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java294
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java257
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaCoreRefactoringMessages.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeleteMappingFileParticipant.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java255
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeleteTypeParticipant.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveFolderParticipant.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveMappingFileParticipant.java242
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveTypeParticipant.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameFolderParticipant.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameMappingFileParticipant.java189
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenamePackageParticipant.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameTypeParticipant.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/contenttypes/IndeterminateContentDescriber.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaResourceNode.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumnAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionAnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotatedElement.java225
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java163
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java125
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java116
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java657
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java190
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java694
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryAnnotation.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java232
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/AnnotationContainerTools.java281
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotatedElement.java472
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotation.java265
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java245
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java182
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseColumnAnnotation.java334
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTableAnnotation.java426
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBasicAnnotation.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceColumnAnnotation.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompilationUnit.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java222
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java181
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddableAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEntityAnnotation.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEnumeratedAnnotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratorAnnotation.java186
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceInheritanceAnnotation.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnAnnotation.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinTableAnnotation.java409
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceLobAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToManyAnnotation.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToOneAnnotation.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMapKeyAnnotation.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java250
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java131
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueryAnnotation.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNode.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToManyAnnotation.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToOneAnnotation.java227
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOrderByAnnotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOverrideAnnotation.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePackage.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java408
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java930
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryAnnotation.java351
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryHintAnnotation.java201
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java357
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java283
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java470
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTemporalAnnotation.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTransientAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTypeCompilationUnit.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceVersionAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourcePropertyTester.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/DefaultJpaValidationMessages.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaHelper.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationDescriptionMessages.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java226
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationPreferences.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java122
760 files changed, 0 insertions, 113591 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefinitionProvider.java
deleted file mode 100644
index 3ac9ac36e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaAnnotationDefinitionProvider.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
deleted file mode 100644
index 9243cd3e47..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaFactory.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaOverrideRelationship;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaOrderable;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.context.java.JavaTable;
-import org.eclipse.jpt.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualOverrideRelationship;
-import org.eclipse.jpt.core.context.java.JavaVirtualAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualColumn;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinTable;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaVirtualUniqueConstraint;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.context.java.GenericJavaVirtualJoinTable;
-import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping;
-import org.eclipse.jpt.core.internal.jpa1.GenericJpaDataSource;
-import org.eclipse.jpt.core.internal.jpa1.GenericJpaFile;
-import org.eclipse.jpt.core.internal.jpa1.GenericJpaProject;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericRootContextNode;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAssociationOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOverrideRelationship;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAttributeOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaBasicMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEmbeddable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEmbeddedMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEntity;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEnumeratedConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaGeneratedValue;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaGeneratorContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaIdMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaJoinTable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaLobConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaManyToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaManyToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaMappedSuperclass;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNamedNativeQuery;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNamedQuery;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOneToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOneToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOrderable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPersistentType;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaQueryContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaQueryHint;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaSecondaryTable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaSequenceGenerator;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaTable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaTableGenerator;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaTemporalConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaTransientMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVersionMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVirtualAssociationOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVirtualOverrideRelationship;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVirtualAttributeOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVirtualColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVirtualJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaVirtualUniqueConstraint;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmXml;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceXml;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/AbstractJpaNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaNode.java
deleted file mode 100644
index 5a9e2e83af..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaNode.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.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.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaNode;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformVariation;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.AspectChangeSupport;
-import org.eclipse.jpt.utility.internal.model.ChangeSupport;
-
-/**
- * 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 JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/AbstractJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaPlatformProvider.java
deleted file mode 100644
index 6a2dcff747..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaPlatformProvider.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.ResourceDefinition;
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
deleted file mode 100644
index 98f0a1efaf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/AbstractJpaProject.java
+++ /dev/null
@@ -1,1955 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaFacet;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryPersistentTypeCache;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTypeCompilationUnit;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageInfoCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentTypeCache;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.Command;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.BitTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.ThreadLocalCommandExecutor;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.synchronizers.CallbackSynchronousSynchronizer;
-import org.eclipse.jpt.utility.internal.synchronizers.SynchronousSynchronizer;
-import org.eclipse.jpt.utility.synchronizers.CallbackSynchronizer;
-import org.eclipse.jpt.utility.synchronizers.Synchronizer;
-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;
- JptCorePlugin.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;
- JptCorePlugin.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;
- JptCorePlugin.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) {
- JptCorePlugin.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(
- JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH,
- JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE
- );
- }
-
- public JpaXmlResource getDefaultOrmXmlResource() {
- return this.getMappingFileXmlResource(JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
- }
-
- public JpaXmlResource getMappingFileXmlResource(IPath runtimePath) {
- return (JpaXmlResource) this.getResourceModel(runtimePath, JptCorePlugin.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)) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
deleted file mode 100644
index 1c51869848..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.core.internal;
-
-import org.eclipse.jpt.core.EntityGeneratorDatabaseAnnotationNameBuilder;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.ForeignKey;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationDefinitionProvider.java
deleted file mode 100644
index 748745394d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationDefinitionProvider.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.internal.resource.java.AssociationOverrideAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AssociationOverridesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.BasicAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddedIdAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EntityAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EnumeratedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.GeneratedValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdClassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.InheritanceAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.LobAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ManyToManyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ManyToOneAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MapKeyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedQueriesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedQueryAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OneToManyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OneToOneAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OrderByAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTablesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SequenceGeneratorAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableGeneratorAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TemporalAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TransientAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.VersionAnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-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.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java
deleted file mode 100644
index ac6242048b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaAnnotationProvider.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.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.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatform.java
deleted file mode 100644
index d1f1ab0b09..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatform.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.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.core.EntityGeneratorDatabaseAnnotationNameBuilder;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.JpaFile;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaPlatformVariation;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.ResourceDefinition;
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.JptDbPlugin;
-
-/**
- * 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 JptCorePlugin.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 JptDbPlugin.getConnectionProfileFactory();
- }
-
- public EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder() {
- return GenericEntityGeneratorDatabaseAnnotationNameBuilder.instance();
- }
-
-
- // ********** validation **********
-
- public JpaPlatformVariation getJpaVariation() {
- return this.jpaVariation;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformFactory.java
deleted file mode 100644
index 11343c4850..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformFactory.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.Comparator;
-import org.eclipse.jpt.core.JpaFacet;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformFactory;
-import org.eclipse.jpt.core.JpaPlatformVariation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformProvider.java
deleted file mode 100644
index 6b10d9d230..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/GenericJpaPlatformProvider.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-import java.util.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.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.ResourceDefinition;
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaBasicMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddableDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEntityDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaManyToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaManyToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaMappedSuperclassDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaOneToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaOneToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaVersionMappingDefinition;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * 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(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/JarResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JarResourceModelProvider.java
deleted file mode 100644
index 4ffcb937b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JarResourceModelProvider.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal;
-
-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.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/JavaPackageInfoResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaPackageInfoResourceModelProvider.java
deleted file mode 100644
index 8df557a92a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaPackageInfoResourceModelProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.internal.resource.java.source.SourcePackageInfoCompilationUnit;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/JavaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaResourceModelProvider.java
deleted file mode 100644
index 87ab6e6d16..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JavaResourceModelProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTypeCompilationUnit;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/JpaPlatformTester.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformTester.java
deleted file mode 100644
index 910aab1e44..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaPlatformTester.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.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 = JptCorePlugin.getJpaPlatformManager().getJpaPlatform((String) expectedValue);
- return platform == null ? false : platform.equals(otherPlatform);
- }
- if (property.equals("jpaPlatformGroup")) {
- JpaPlatformGroupDescription group = (platform == null) ? null : platform.getGroup();
- JpaPlatformGroupDescription otherGroup = JptCorePlugin.getJpaPlatformManager().getJpaPlatformGroup((String) expectedValue);
- return group == null ? false : group.equals(otherGroup);
- }
- return false;
- }
-
- private JpaPlatformDescription platform(IProject project) {
- return (project == null)
- ? null
- : JptCorePlugin.getJpaPlatformManager().getJpaPlatform(JptCorePlugin.getJpaPlatformId(project));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaTester.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaTester.java
deleted file mode 100644
index cb32a9531c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JpaTester.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/******************************************************************************
- * 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.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.core.JptCorePlugin;
-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) {
- JptCorePlugin.log(e.getStatus());
- return false;
- }
- }
- }
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
deleted file mode 100644
index 9c6b8957da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/JptCoreMessages.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/OrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/OrmResourceModelProvider.java
deleted file mode 100644
index 037784f18c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/OrmResourceModelProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.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 JptCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
- public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
- return OrmXmlResourceProvider.getXmlResourceProvider(file).getXmlResource();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/PersistenceResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/PersistenceResourceModelProvider.java
deleted file mode 100644
index 1e12878e0c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/PersistenceResourceModelProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.resource.persistence.PersistenceXmlResourceProvider;
-import org.eclipse.jpt.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 JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE;
- }
-
- public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
- return PersistenceXmlResourceProvider.getXmlResourceProvider(file).getXmlResource();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ProjectAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ProjectAdapterFactory.java
deleted file mode 100644
index fa80271fb8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/ProjectAdapterFactory.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * 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.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-
-/**
- * [Double-duty] factory to build adapters for either standard projects or
- * Java projects:
- * - JPA project
- *
- * See org.eclipse.jpt.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 JptCorePlugin.getJpaProject(project);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java
deleted file mode 100644
index 2433fa229e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/SimpleJpaProjectConfig.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * 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.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/AbstractJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractJpaContextNode.java
deleted file mode 100644
index 6aa326e4b0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractJpaContextNode.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context;
-
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.core.JpaNode;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.AbstractJpaNode;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.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.core.internal.context.java.AbstractJavaJpaContextNode#getResourceType() AbstractJavaJpaContextNode}
- * <li>{@link org.eclipse.jpt.core.internal.jpa1.context.java.GenericJarFile#getResourceType() GenericJarFile}
- * <li>{@link org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmXml#getResourceType() GenericOrmXml}
- * <li>{@link org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceXml#getResourceType() GenericPersistenceXml}
- * </ul>
- */
- public JptResourceType getResourceType() {
- return this.getParent().getResourceType();
- }
-
- /**
- * Overridden in:<ul>
- * <li>{@link org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit#getPersistenceUnit() AbstractPersistenceUnit}
- * to return itself
- * <li>{@link org.eclipse.jpt.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.core.internal.context.orm.AbstractEntityMappings#getMappingFileRoot() AbstractEntityMappings}
- * to return itself
- * <li>{@link org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/AbstractXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractXmlContextNode.java
deleted file mode 100644
index 6e03b5fa25..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AbstractXmlContextNode.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/AttributeMappingTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AttributeMappingTools.java
deleted file mode 100644
index a6f552263c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/AttributeMappingTools.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.utility.internal.Transformer;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/BaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseColumnTextRangeResolver.java
deleted file mode 100644
index c823b23955..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseColumnTextRangeResolver.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/BaseJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseJoinColumnTextRangeResolver.java
deleted file mode 100644
index f258116bfa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/BaseJoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/ContextContainerTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/ContextContainerTools.java
deleted file mode 100644
index b704367260..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/ContextContainerTools.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/EntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/EntityTextRangeResolver.java
deleted file mode 100644
index 694feefb54..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/EntityTextRangeResolver.java
+++ /dev/null
@@ -1,18 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context;
-
-
-public interface EntityTextRangeResolver
- extends PrimaryKeyTextRangeResolver
-{
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JoinColumnTextRangeResolver.java
deleted file mode 100644
index c21f3ebc88..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/JptValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JptValidator.java
deleted file mode 100644
index 41b38db1ca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/JptValidator.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java
deleted file mode 100644
index db474d072b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/MappingTools.java
+++ /dev/null
@@ -1,432 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.JpaNamedContextNode;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.core.context.ReferenceTable;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.CollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.ElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Transformer;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/NamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/NamedColumnTextRangeResolver.java
deleted file mode 100644
index 8a9cf96216..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/NamedColumnTextRangeResolver.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/OverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/OverrideTextRangeResolver.java
deleted file mode 100644
index 1ce941fc40..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/OverrideTextRangeResolver.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributePropertyTester.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributePropertyTester.java
deleted file mode 100644
index 4c18561df2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributePropertyTester.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java
deleted file mode 100644
index eb2fd74835..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PersistentAttributeTextRangeResolver.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java
deleted file mode 100644
index 33c83a4bb6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/TableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TableTextRangeResolver.java
deleted file mode 100644
index 87f82ee1d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TableTextRangeResolver.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTextRangeResolver.java
deleted file mode 100644
index 29e6a63ac8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTextRangeResolver.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTools.java
deleted file mode 100644
index 948642f691..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTools.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.ReadOnlyTable;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java
deleted file mode 100644
index 696c6dc0b8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaAttributeMapping.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.jpa2.context.SimpleMetamodelField;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java
deleted file mode 100644
index 1d6cc669b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseColumn.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.core.context.java.JavaBaseColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
deleted file mode 100644
index 90e1177b72..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
deleted file mode 100644
index 20c0f25b21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMapping.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.Association;
-import org.eclipse.jpt.utility.internal.SimpleAssociation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMappingDefinition.java
deleted file mode 100644
index 501ccc2c51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBasicMappingDefinition.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java
deleted file mode 100644
index dbfed564a4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddable.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java
deleted file mode 100644
index 42338a3522..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
deleted file mode 100644
index ca15e753ab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
+++ /dev/null
@@ -1,1816 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaPlatformVariation.Supported;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumn.Owner;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyTable;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.core.context.java.JavaOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.java.JavaTable;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.EntityTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.DiscriminatorColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityPrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.MappedSuperclassOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.SecondaryTableValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.TableValidator;
-import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jpt.utility.internal.NotNullFilter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-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.db.Table getPrimaryDbTable() {
- return this.table.getDbTable();
- }
-
- @Override
- public org.eclipse.jpt.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.db.Table> getAllAssociatedDbTables() {
- return new FilteringIterable<org.eclipse.jpt.db.Table>(this.getAllAssociatedDbTables_(), NotNullFilter.<org.eclipse.jpt.db.Table>instance());
- }
-
- protected Iterable<org.eclipse.jpt.db.Table> getAllAssociatedDbTables_() {
- return new TransformationIterable<ReadOnlyTable, org.eclipse.jpt.db.Table>(this.getAllAssociatedTables()) {
- @Override
- protected org.eclipse.jpt.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.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.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.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaGenerator.java
deleted file mode 100644
index 02b0e3cfc8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaGenerator.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.java.JavaGenerator;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
deleted file mode 100644
index 2a57797d71..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMapping.java
+++ /dev/null
@@ -1,476 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.IdMapping2_0;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.Association;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.SimpleAssociation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingDefinition.java
deleted file mode 100644
index 5cabb6f4db..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaIdMappingDefinition.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 5eaa6a32dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnRelationship;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java
deleted file mode 100644
index e448591108..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationship;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.Tools;
-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.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJpaContextNode.java
deleted file mode 100644
index af59c7fa82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaJpaContextNode.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.AbstractJpaContextNode;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMapping.java
deleted file mode 100644
index 4524b085c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMapping.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaManyToManyRelationship;
-import org.eclipse.jpt.core.context.java.JavaMappingRelationship;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.context.java.JavaManyToManyMapping2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java
deleted file mode 100644
index 98d9786dfb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMapping.java
deleted file mode 100644
index 128f3baca3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMapping.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaManyToOneRelationship;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.context.java.JavaManyToOneMapping2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java
deleted file mode 100644
index 4a5e0f360f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
deleted file mode 100644
index f81e3de2b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericMappedSuperclassPrimaryKeyValidator;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappingRelationship.java
deleted file mode 100644
index bc76a3baed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappingRelationship.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipStrategy;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaMappingRelationship;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
deleted file mode 100644
index 2a7ff5f508..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
+++ /dev/null
@@ -1,780 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.RelationshipStrategy;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaOrderable;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyColumnValidator;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaMapKeyColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
deleted file mode 100644
index 822326922b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaNamedColumn.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.resource.java.NamedColumnAnnotation;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java
deleted file mode 100644
index 9499b97f81..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMapping.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaMappingRelationship;
-import org.eclipse.jpt.core.context.java.JavaOneToManyRelationship;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToManyMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java
deleted file mode 100644
index c21735ab9c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java
deleted file mode 100644
index d6a6a188e6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMapping.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaOneToOneRelationship;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java
deleted file mode 100644
index 6e0a445ac3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java
deleted file mode 100644
index 54e7d24f9f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaOverride.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.core.context.java.JavaOverride;
-import org.eclipse.jpt.core.context.java.JavaOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaVirtualOverride;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.resource.java.OverrideAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java
deleted file mode 100644
index fa58808ee8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentAttribute.java
+++ /dev/null
@@ -1,816 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.CollectionMapping;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaStructureNodes;
-import org.eclipse.jpt.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.ClassName;
-import org.eclipse.jpt.utility.internal.ReflectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java
deleted file mode 100644
index 516ae9f23e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaPersistentType.java
+++ /dev/null
@@ -1,722 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaStructureNodes;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNode;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ClassName;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.ChainIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SnapshotCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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) {
- JptCorePlugin.log(t);
- }
- }
-
- protected void validateAttributes(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- for (JavaPersistentAttribute attribute : this.getAttributes()) {
- this.validateAttribute(attribute, reporter, messages, astRoot);
- }
- }
-
- protected void validateAttribute(JavaPersistentAttribute attribute, IReporter reporter, List<IMessage> messages, CompilationUnit astRoot) {
- try {
- attribute.validate(messages, reporter, astRoot);
- } catch(Throwable t) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java
deleted file mode 100644
index 02945a5bb2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaQuery.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.resource.java.QueryAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java
deleted file mode 100644
index 7a3aa5589f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.Vector;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaReadOnlyUniqueConstraint;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java
deleted file mode 100644
index 07f84a51aa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaRelationshipMapping.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaCascade;
-import org.eclipse.jpt.core.context.java.JavaMappingRelationship;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaCascade;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java
deleted file mode 100644
index a7a78f8651..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSequenceGenerator.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
deleted file mode 100644
index 9d5ac87c20..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.java.SingleRelationshipMappingAnnotation;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java
deleted file mode 100644
index 7188ae8b55..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTable.java
+++ /dev/null
@@ -1,584 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyTable;
-import org.eclipse.jpt.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaTable;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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.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.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.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
deleted file mode 100644
index 03651af526..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.ReadOnlyTable;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericTypeMappingValidator;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.NotNullFilter;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-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.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.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
deleted file mode 100644
index d060bc8fec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMapping.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.Association;
-import org.eclipse.jpt.utility.internal.SimpleAssociation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMappingDefinition.java
deleted file mode 100644
index 20266a7d8b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVersionMappingDefinition.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.VersionAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualBaseColumn.java
deleted file mode 100644
index c7dda8ae1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualBaseColumn.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.core.context.VirtualBaseColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
deleted file mode 100644
index fbbb5e1750..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.core.context.VirtualNamedColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualOverride.java
deleted file mode 100644
index e3d271d154..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualOverride.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaOverride;
-import org.eclipse.jpt.core.context.java.JavaOverrideContainer;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
deleted file mode 100644
index 786971d9a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReferenceTable;
-import org.eclipse.jpt.core.context.VirtualReferenceTable;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualTable.java
deleted file mode 100644
index b4c7634e8b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaVirtualTable.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Table;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.VirtualTable;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaVirtualUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-
-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.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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java
deleted file mode 100644
index b939bb454d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaIdClassReference.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToManyRelationship.java
deleted file mode 100644
index cd29ee1b0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToManyRelationship.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.core.context.java.JavaManyToManyRelationship;
-import org.eclipse.jpt.core.context.java.JavaMappedByRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToOneRelationship.java
deleted file mode 100644
index ba45fa478d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaManyToOneRelationship.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.jpa2.context.java.JavaManyToOneRelationship2_0;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java
deleted file mode 100644
index 71303bb3c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.MappedByRelationshipStrategy;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaMappedByRelationship;
-import org.eclipse.jpt.core.context.java.JavaMappedByRelationshipStrategy;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 68406714e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaMappingJoinColumnRelationship;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterators.SubIteratorWrapper;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyRelationship.java
deleted file mode 100644
index 6ee4185d76..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToManyRelationship.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaMappedByRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToManyRelationship2_0;
-import org.eclipse.jpt.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToOneRelationship.java
deleted file mode 100644
index 7970449a51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOneToOneRelationship.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaMappedByRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOneToOneRelationship2_0;
-import org.eclipse.jpt.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
deleted file mode 100644
index d74d03b24b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn.Owner;
-import org.eclipse.jpt.core.context.java.JavaOverrideRelationship;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 963060618d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterators.SubIteratorWrapper;
-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.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVirtualJoinTable.java
deleted file mode 100644
index c529488dff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/GenericJavaVirtualJoinTable.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinTable;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaVirtualRelationship;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-
-/**
- * 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.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBaseColumnTextRangeResolver.java
deleted file mode 100644
index 0cd20f0aa9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBaseColumnTextRangeResolver.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaBaseColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingDefinition.java
deleted file mode 100644
index b76fe77805..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaBasicMappingDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableDefinition.java
deleted file mode 100644
index ec93753f3c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddableDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
deleted file mode 100644
index ba0477dbcd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingDefinition.java
deleted file mode 100644
index ca65d61d47..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEmbeddedMappingDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityDefinition.java
deleted file mode 100644
index b4c4eca420..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityDefinition.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityTextRangeResolver.java
deleted file mode 100644
index eb2f032719..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaEntityTextRangeResolver.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingDefinition.java
deleted file mode 100644
index 9a14273a04..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaIdMappingDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumnTextRangeResolver.java
deleted file mode 100644
index 863d7131df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaJoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingDefinition.java
deleted file mode 100644
index e564c7f481..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToManyMappingDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingDefinition.java
deleted file mode 100644
index 977689ac59..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaManyToOneMappingDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassDefinition.java
deleted file mode 100644
index 551788f8da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassDefinition.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java
deleted file mode 100644
index fb19012f40..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumnTextRangeResolver.java
deleted file mode 100644
index 0f0545247c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNamedColumnTextRangeResolver.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java
deleted file mode 100644
index 2efbaf0cb8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaNullTypeMapping.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * 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.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.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingDefinition.java
deleted file mode 100644
index f9b759e0c2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToManyMappingDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingDefinition.java
deleted file mode 100644
index 89544c9f2a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOneToOneMappingDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaOverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOverrideTextRangeResolver.java
deleted file mode 100644
index 157ed06946..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaOverrideTextRangeResolver.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaOverride;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java
deleted file mode 100644
index 57f14403ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java
deleted file mode 100644
index 50eb51bdb3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaTableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTableTextRangeResolver.java
deleted file mode 100644
index f2922f9c69..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTableTextRangeResolver.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaTable;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingDefinition.java
deleted file mode 100644
index 3db0e08f05..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTransientMappingDefinition.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.resource.java.TransientAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMappingTextRangeResolver.java
deleted file mode 100644
index b03e98b64f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMappingTextRangeResolver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingDefinition.java
deleted file mode 100644
index 239d43492a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaVersionMappingDefinition.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractEntityMappings.java
deleted file mode 100644
index 12dcb37b33..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractEntityMappings.java
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmGenerator;
-import org.eclipse.jpt.core.context.orm.OrmIdClassReference;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitMetadata;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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 JptCorePlugin.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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java
deleted file mode 100644
index 4a02414b41..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmAttributeMapping.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.ColumnMapping;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmBaseEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmMultiRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmSingleRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.jpa2.context.SimpleMetamodelField;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
deleted file mode 100644
index cc3a80e263..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseColumn.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmBaseColumn;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
deleted file mode 100644
index a14b75fdef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmBaseEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlEmbedded;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.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.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java
deleted file mode 100644
index 233567afcf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBasicMapping.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*******************************************************************************
- * 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.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.core.MappingKeys;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmEnumeratedConverter;
-import org.eclipse.jpt.core.context.orm.OrmLobConverter;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.NullOrmConverter;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddable.java
deleted file mode 100644
index 65b4ea0fb2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEmbeddable.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.ReadOnlyTable;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
deleted file mode 100644
index 5ccf4c82a3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
+++ /dev/null
@@ -1,2285 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaPlatformVariation.Supported;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.InheritanceType;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumn.Owner;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlySecondaryTable;
-import org.eclipse.jpt.core.context.ReadOnlyTable;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaReadOnlyAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.core.context.orm.OrmIdClassReference;
-import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
-import org.eclipse.jpt.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmTable;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualSecondaryTable;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.EntityTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.DiscriminatorColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityPrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.MappedSuperclassOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.SecondaryTableValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.TableValidator;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.Inheritance;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlDiscriminatorColumn;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlIdClassContainer;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.utility.internal.ClassName;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jpt.utility.internal.NotNullFilter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SnapshotCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.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.db.Table getPrimaryDbTable() {
- return this.table.getDbTable();
- }
-
- @Override
- public org.eclipse.jpt.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.db.Table> getAllAssociatedDbTables() {
- return new FilteringIterable<org.eclipse.jpt.db.Table>(this.getAllAssociatedDbTables_(), NotNullFilter.<org.eclipse.jpt.db.Table>instance());
- }
-
- protected Iterable<org.eclipse.jpt.db.Table> getAllAssociatedDbTables_() {
- return new TransformationIterable<ReadOnlyTable, org.eclipse.jpt.db.Table>(this.getAllAssociatedTables()) {
- @Override
- protected org.eclipse.jpt.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.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.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.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmGenerator.java
deleted file mode 100644
index 5a756ebdc9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmGenerator.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmGenerator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.resource.orm.XmlGenerator;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java
deleted file mode 100644
index 206805a90c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmIdMapping.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*******************************************************************************
- * 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.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.core.MappingKeys;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.NullOrmConverter;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.IdMapping2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 1cc6b82dff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnRelationship;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumnContainer;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java
deleted file mode 100644
index d32ca5539c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationship;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTableContainer;
-import org.eclipse.jpt.utility.internal.Tools;
-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.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToManyMapping.java
deleted file mode 100644
index 2b995ec0a9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToManyMapping.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyRelationship;
-import org.eclipse.jpt.core.context.orm.OrmMappingRelationship;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmManyToManyMapping2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToOneMapping.java
deleted file mode 100644
index 708eadf556..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmManyToOneMapping.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmManyToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmManyToOneRelationship2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappedSuperclass.java
deleted file mode 100644
index e5aa78e269..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappedSuperclass.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * 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.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.core.MappingKeys;
-import org.eclipse.jpt.core.context.ReadOnlyTable;
-import org.eclipse.jpt.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmIdClassReference;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericMappedSuperclassPrimaryKeyValidator;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlIdClassContainer;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappingRelationship.java
deleted file mode 100644
index 41df4fd7e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMappingRelationship.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipStrategy;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmMappingRelationship;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
deleted file mode 100644
index a52d32249d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ /dev/null
@@ -1,813 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmMultiRelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyColumnValidator;
-import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlMultiRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.MapKey;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlClassReference;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
deleted file mode 100644
index 285ed07877..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmNamedColumn.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlNamedColumn;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyMapping.java
deleted file mode 100644
index 0ea0d52208..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToManyMapping.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOneToManyMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOneToManyRelationship2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToOneMapping.java
deleted file mode 100644
index 22cb596504..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmOneToOneMapping.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmMappingRelationship;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOneToOneMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOneToOneRelationship2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmQuery.java
deleted file mode 100644
index 087cadc001..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmQuery.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Vector;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.QueryHint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmQuery;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlQuery;
-import org.eclipse.jpt.core.resource.orm.XmlQueryHint;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java
deleted file mode 100644
index 0eac63ea57..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.Vector;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyUniqueConstraint;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java
deleted file mode 100644
index ae0ff352cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmRelationshipMapping.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmCascade;
-import org.eclipse.jpt.core.context.orm.OrmMappingRelationship;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmCascade;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSequenceGenerator.java
deleted file mode 100644
index 67d5e26b92..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSequenceGenerator.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
deleted file mode 100644
index 91c0dbe1c2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmSingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTable.java
deleted file mode 100644
index 1985587235..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTable.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyTable;
-import org.eclipse.jpt.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmTable;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlTable;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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.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.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
deleted file mode 100644
index 2b6da0a676..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericTypeMappingValidator;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java
deleted file mode 100644
index aed79ed89a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVersionMapping.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.NullOrmConverter;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java
deleted file mode 100644
index 87f7acdfc4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
deleted file mode 100644
index ef8ad496ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
deleted file mode 100644
index 5ff44e76b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReferenceTable;
-import org.eclipse.jpt.core.context.VirtualReferenceTable;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualTable.java
deleted file mode 100644
index 8ce7db479f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmVirtualTable.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.VirtualTable;
-import org.eclipse.jpt.core.context.orm.OrmVirtualUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-
-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.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java
deleted file mode 100644
index bde7a4256c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNode.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
-import org.eclipse.jpt.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.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
deleted file mode 100644
index 0dab66ef74..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
+++ /dev/null
@@ -1,386 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn.Owner;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmOverrideRelationship;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitMetadata;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmQuery;
-import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTable;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmVirtualOverrideRelationship;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmVirtualColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmVirtualUniqueConstraint;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericEntityMappings;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAssociationOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOverrideRelationship;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAttributeOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmBasicMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEmbeddable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEmbeddedMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEntity;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmEnumeratedConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmGeneratedValue;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmGeneratorContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmIdMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmJoinTable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmLobConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmManyToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmManyToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmMappedSuperclass;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNamedNativeQuery;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNamedQuery;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmNullAttributeMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOneToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOneToOneMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOrderable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPersistentType;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmQueryContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmQueryHint;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmSecondaryTable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmSequenceGenerator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmTable;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmTableGenerator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmTemporalConverter;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmTransientMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmUniqueConstraint;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVersionMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVirtualAssociationOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVirtualOverrideRelationship;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVirtualAttributeOverride;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVirtualColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVirtualJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmVirtualUniqueConstraint;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.UnsupportedOrmAttributeMapping;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratorContainer;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlQueryContainer;
-import org.eclipse.jpt.core.resource.orm.XmlQueryHint;
-import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlDefinition.java
deleted file mode 100644
index b08720996c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmXmlDefinition.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-import java.util.ArrayList;
-
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.core.context.orm.UnsupportedOrmAttributeMappingDefinition;
-import org.eclipse.jpt.utility.internal.Tools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdClassReference.java
deleted file mode 100644
index 4cc0ee3de5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmIdClassReference.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmIdClassReference;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlClassReference;
-import org.eclipse.jpt.core.resource.orm.XmlIdClassContainer;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyRelationship.java
deleted file mode 100644
index 6b73621b66..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToManyRelationship.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.core.context.orm.OrmManyToManyRelationship;
-import org.eclipse.jpt.core.context.orm.OrmMappedByRelationshipStrategy;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToOneRelationship.java
deleted file mode 100644
index 3a56900b0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmManyToOneRelationship.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmManyToOneRelationship2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java
deleted file mode 100644
index 010b2cc334..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.MappedByRelationshipStrategy;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmMappedByRelationship;
-import org.eclipse.jpt.core.context.orm.OrmMappedByRelationshipStrategy;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.XmlMappedByMapping;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.Tools;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 7044a2feed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn.Owner;
-import org.eclipse.jpt.core.context.orm.OrmMappingJoinColumnRelationship;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java
deleted file mode 100644
index dbc6c84457..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.orm.OrmMappingJoinTableRelationship;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.InverseJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyRelationship.java
deleted file mode 100644
index 8f5c48d28d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToManyRelationship.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmMappedByRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.NullOrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOneToManyRelationship2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneRelationship.java
deleted file mode 100644
index 85664e0dec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOneToOneRelationship.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmMappedByRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOneToOneRelationship2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
deleted file mode 100644
index faa0dd9873..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn.Owner;
-import org.eclipse.jpt.core.context.orm.OrmOverrideRelationship;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
deleted file mode 100644
index c0249b5363..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumnContainer;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualJoinTable.java
deleted file mode 100644
index 8979bec16a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualJoinTable.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmVirtualRelationship;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-
-/**
- * <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.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 3dbf242705..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,333 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumnRelationship;
-import org.eclipse.jpt.core.context.JoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinColumnRelationship;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmVirtualOverrideRelationship;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
deleted file mode 100644
index 8c0676b2e4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualSecondaryTable;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java
deleted file mode 100644
index 670ab9559d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.orm;
-
-
-public class GenericOrmXmlContextNodeFactory
- extends AbstractOrmXmlContextNodeFactory
-{
- // nothing
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java
deleted file mode 100644
index 5d820bffe8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationship;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java
deleted file mode 100644
index ec5c9c36dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmBaseColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBasicMappingDefinition.java
deleted file mode 100644
index bd46168ad8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmBasicMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddableDefinition.java
deleted file mode 100644
index d908024b78..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddableDefinition.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java
deleted file mode 100644
index b2695d5ecf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedMappingDefinition.java
deleted file mode 100644
index 56a9327724..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEmbeddedMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityDefinition.java
deleted file mode 100644
index cf734f64dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityDefinition.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityTextRangeResolver.java
deleted file mode 100644
index 48e6d9c9cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmEntityTextRangeResolver.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmIdMappingDefinition.java
deleted file mode 100644
index 15b795b77a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmIdMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlId;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java
deleted file mode 100644
index 294a6f7027..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToManyMappingDefinition.java
deleted file mode 100644
index 7bb0a47484..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToManyMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToOneMappingDefinition.java
deleted file mode 100644
index fd7e0dd394..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmManyToOneMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassDefinition.java
deleted file mode 100644
index c0e2f67d6f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassDefinition.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java
deleted file mode 100644
index 21ca98b6ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java
deleted file mode 100644
index 790011635c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmNamedColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToManyMappingDefinition.java
deleted file mode 100644
index 0e76251234..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToManyMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToOneMappingDefinition.java
deleted file mode 100644
index 945cae45b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOneToOneMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOverrideTextRangeResolver.java
deleted file mode 100644
index 8bd9223701..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmOverrideTextRangeResolver.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmOverride;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java
deleted file mode 100644
index adf92fc3bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java
deleted file mode 100644
index f24122b15a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTableTextRangeResolver.java
deleted file mode 100644
index 289fae65c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTableTextRangeResolver.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmTable;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTransientMappingDefinition.java
deleted file mode 100644
index c822913a29..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTransientMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java
deleted file mode 100644
index ccaaa910d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/OrmVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmVersionMappingDefinition.java
deleted file mode 100644
index 8f7063fa3f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmVersionMappingDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
deleted file mode 100644
index 73053e3ac3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.CollectionMapping;
-import org.eclipse.jpt.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-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.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualOrmPersistentAttribute.java
deleted file mode 100644
index b216b1176b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/VirtualOrmPersistentAttribute.java
+++ /dev/null
@@ -1,585 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmReadOnlyPersistentAttribute2_0;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.model.event.StateChangeEvent;
-import org.eclipse.jpt.utility.model.listener.StateChangeListener;
-
-/**
- * <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.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.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java
deleted file mode 100644
index 65f85a92ef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractJarFileRef.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.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.core.JpaFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JarFile;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-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 JptCorePlugin.getJarRuntimeRootPath(this.getProject());
- }
-
- protected boolean projectHasWebFacet() {
- return JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java
deleted file mode 100644
index 4972d9b651..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractMappingFileRef.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.MappingFile;
-import org.eclipse.jpt.core.context.MappingFilePersistenceUnitMetadata;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-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.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.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
deleted file mode 100644
index 7b0709d696..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ /dev/null
@@ -1,2404 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.context.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.MappingFilePersistenceUnitDefaults;
-import org.eclipse.jpt.core.context.MappingFilePersistenceUnitMetadata;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.core.context.persistence.PersistentTypeContainer;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.context.MappingFilePersistenceUnitDefaults2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.core.jpa2.context.PersistentType2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.SharedCacheMode;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.ValidationMode;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.persistence.XmlProperties;
-import org.eclipse.jpt.core.resource.persistence.XmlProperty;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jpt.utility.internal.NotNullFilter;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-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(JptCorePlugin.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) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
-
- protected void deleteMetamodelFile(IFile file) {
- try {
- this.deleteMetamodelFile_(file);
- } catch (CoreException ex) {
- JptCorePlugin.log(ex);
- }
- }
-
- protected void deleteMetamodelFile_(IFile file) throws CoreException {
- if (this.fileIsGeneratedMetamodel(file)) {
- file.delete(true, null); // true = force
- }
- }
-
- protected boolean fileIsGeneratedMetamodel(IFile file) {
- 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.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java
deleted file mode 100644
index f1e126898e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceUnitProperties.java
+++ /dev/null
@@ -1,529 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.context.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.core.JpaProject;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.utility.internal.ReflectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-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.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java
deleted file mode 100644
index 71a4449f83..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.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.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.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
deleted file mode 100644
index ba9c5c2b75..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.java.JarFile;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJarFile;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericClassRef;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericJarFileRef;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericMappingFileRef;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistence;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceUnit;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceUnitProperty;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.ImpliedMappingFileRef;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.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, JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
deleted file mode 100644
index 3add04d011..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
deleted file mode 100644
index 64b67b65b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.connection.NullConnection2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/facet/FacetTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/FacetTools.java
deleted file mode 100644
index 14ed26c222..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/FacetTools.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetActionDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetActionDelegate.java
deleted file mode 100644
index b91372feaf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetActionDelegate.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core.JptCorePlugin;
-import org.eclipse.jpt.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);
- JptCorePlugin.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
- JptCorePlugin.setConnectionProfileName(project, (String) dataModel.getProperty(CONNECTION));
- subMonitor.worked(1);
-
- if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
- JptCorePlugin.setUserOverrideDefaultCatalog(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_CATALOG));
- }
- subMonitor.worked(1);
-
- if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
- JptCorePlugin.setUserOverrideDefaultSchema(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_SCHEMA));
- }
- subMonitor.worked(1);
-
- JptCorePlugin.setDiscoverAnnotatedClasses(project, dataModel.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES));
- subMonitor.worked(1);
-
- // defaults settings
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProperties.java
deleted file mode 100644
index 4c2c6e051e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProperties.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java
deleted file mode 100644
index bb7065e13b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetDataModelProvider.java
+++ /dev/null
@@ -1,715 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core.JpaFacet;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.DatabaseIdentifierAdapter;
-import org.eclipse.jpt.db.JptDbPlugin;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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>(
- JptCorePlugin.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 JptCorePlugin.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 JptDbPlugin.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, JptCorePlugin.PLUGIN_ID, message);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProperties.java
deleted file mode 100644
index 4a0bfb1c57..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProperties.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java
deleted file mode 100644
index c576475364..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDataModelProvider.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.facet;
-
-import java.util.Set;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.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 JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
deleted file mode 100644
index 19e9d201ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetInstallDelegate.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProvider;
-import org.eclipse.jpt.db.JptDbPlugin;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-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 = JptDbPlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.log(ex);
- }
- }
-
- protected IPath defaultResourceLocation(IProject project) {
- ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(project);
- if (resourceLocator == null) {
- JptCorePlugin.log("No resource locator for project");
- return null;
- }
- return resourceLocator.getDefaultResourceLocation(project).getFullPath();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetUninstallDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetUninstallDelegate.java
deleted file mode 100644
index 83697cf9df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetUninstallDelegate.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-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 {
-
- JptCorePlugin.clearProjectPreferences(project);
- JptCorePlugin.clearProjectPersistentProperties(project);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
deleted file mode 100644
index c00035caf9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-
-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 JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDelegate.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDelegate.java
deleted file mode 100644
index a219080b26..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/JpaFacetVersionChangeDelegate.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core.JptCorePlugin;
-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));
-
- JptCorePlugin.rebuildJpaProject(project);
- sm.worked(1);
- // nothing further to do here *just* yet
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/RuntimeChangedListener.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/RuntimeChangedListener.java
deleted file mode 100644
index f9d47036a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/facet/RuntimeChangedListener.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFacet;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-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) {
- JptCorePlugin.log(ce);
- }
- }
- }
-
- protected String getJpaPlatformId(IProject project) {
- JpaProject jpaProject = JptCorePlugin.getJpaProject(project);
- return (jpaProject == null) ? null : jpaProject.getJpaPlatform().getId();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaDataSource.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaDataSource.java
deleted file mode 100644
index 301d0f77ac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaDataSource.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1;
-
-import org.eclipse.jpt.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.AbstractJpaNode;
-import org.eclipse.jpt.db.ConnectionAdapter;
-import org.eclipse.jpt.db.ConnectionListener;
-import org.eclipse.jpt.db.ConnectionProfile;
-import org.eclipse.jpt.db.ConnectionProfileFactory;
-import org.eclipse.jpt.db.ConnectionProfileListener;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.DatabaseIdentifierAdapter;
-import org.eclipse.jpt.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));
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFactory.java
deleted file mode 100644
index 65c0f5237c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFactory.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1;
-
-import org.eclipse.jpt.core.internal.AbstractJpaFactory;
-
-/**
- * Generic JPA
- */
-public class GenericJpaFactory
- extends AbstractJpaFactory
-{
- public GenericJpaFactory() {
- super();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFile.java
deleted file mode 100644
index 23cde7e2e8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaFile.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFile;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.internal.AbstractJpaNode;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaProject.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaProject.java
deleted file mode 100644
index 7d0c986d6f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/GenericJpaProject.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1;
-
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java
deleted file mode 100644
index bfa7b821c5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.IdClassReference;
-import org.eclipse.jpt.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractJoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractJoinTableValidator.java
deleted file mode 100644
index 644be2df0d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractJoinTableValidator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java
deleted file mode 100644
index cc638311a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.IdClassReference;
-import org.eclipse.jpt.core.context.MappedSuperclass;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractNamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractNamedColumnValidator.java
deleted file mode 100644
index 234b749122..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractNamedColumnValidator.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
deleted file mode 100644
index fd75e580f3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
deleted file mode 100644
index 5406d81665..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
+++ /dev/null
@@ -1,618 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.IdClassReference;
-import org.eclipse.jpt.core.context.IdMapping;
-import org.eclipse.jpt.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.SingleRelationshipMapping2_0;
-import org.eclipse.jpt.utility.internal.ClassName;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTableValidator.java
deleted file mode 100644
index 6978570605..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTableValidator.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTypeMappingValidator.java
deleted file mode 100644
index fd5a5c7e35..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTypeMappingValidator.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java
deleted file mode 100644
index 7db43d5acc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java
deleted file mode 100644
index cc7e103e7c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java
deleted file mode 100644
index c47f12d38e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideValidator.java
deleted file mode 100644
index 27fc288b36..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AssociationOverrideValidator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideColumnValidator.java
deleted file mode 100644
index 6178b831dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideColumnValidator.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideValidator.java
deleted file mode 100644
index e65f8f5b22..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AttributeOverrideValidator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseColumnTableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseColumnTableValidator.java
deleted file mode 100644
index fa715edb67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseColumnTableValidator.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.AbstractNamedColumnValidator.TableValidator;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseJoinColumnValidator.java
deleted file mode 100644
index 504e9418af..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/BaseJoinColumnValidator.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.utility.internal.StringTools;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java
deleted file mode 100644
index dbfefa6174..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.jpt.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/DiscriminatorColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/DiscriminatorColumnValidator.java
deleted file mode 100644
index 2ee75962b1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/DiscriminatorColumnValidator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java
deleted file mode 100644
index 97d1b46b03..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.internal.jpa1.context.OverrideValidator.OverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-
-public class EmbeddableOverrideDescriptionProvider implements OverrideDescriptionProvider
-{
- public String getOverrideDescriptionMessage() {
- return JpaValidationDescriptionMessages.ON_EMBEDDABLE;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java
deleted file mode 100644
index 351ceeed95..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityTableDescriptionProvider.java
deleted file mode 100644
index 6810b06c9c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/EntityTableDescriptionProvider.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.jpt.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java
deleted file mode 100644
index 69ff3bb7bf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java
deleted file mode 100644
index b9b47ad7bf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.MappedSuperclass;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericPersistentAttributeValidator.java
deleted file mode 100644
index 2da380507a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericPersistentAttributeValidator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
deleted file mode 100644
index 9741a18c2c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericRootContextNode.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.MappingFileRoot;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.context.AbstractJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.JpaRootContextNode2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceXml2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.HashBag;
-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(JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericTypeMappingValidator.java
deleted file mode 100644
index 02f664ef1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericTypeMappingValidator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/InverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/InverseJoinColumnValidator.java
deleted file mode 100644
index ea691de14a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/InverseJoinColumnValidator.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinColumnValidator.java
deleted file mode 100644
index 249e690f14..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinColumnValidator.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java
deleted file mode 100644
index 487cc10792..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.jpt.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableValidator.java
deleted file mode 100644
index b60662c7d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/JoinTableValidator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java
deleted file mode 100644
index d0c7c50320..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java
deleted file mode 100644
index b7b57cd3f9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyColumnValidator.java
deleted file mode 100644
index 48c517cf0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MapKeyColumnValidator.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java
deleted file mode 100644
index 9a912bc11f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.internal.jpa1.context.OverrideValidator.OverrideDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/NamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/NamedColumnValidator.java
deleted file mode 100644
index cb3148235b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/NamedColumnValidator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java
deleted file mode 100644
index bfb83c5d3b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/OverrideValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/OverrideValidator.java
deleted file mode 100644
index 927d9e5383..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/OverrideValidator.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java
deleted file mode 100644
index f71d8491d4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java
deleted file mode 100644
index d5f78356c5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.RelationshipStrategy;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java
deleted file mode 100644
index 1e067e3511..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTableValidator.java
deleted file mode 100644
index 170c4df6db..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/SecondaryTableValidator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.SecondaryTable;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/TableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/TableValidator.java
deleted file mode 100644
index a9b040a0bf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/TableValidator.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context;
-
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/AbstractJavaConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/AbstractJavaConverter.java
deleted file mode 100644
index 29530c133d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/AbstractJavaConverter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
deleted file mode 100644
index a79b4b8acf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
+++ /dev/null
@@ -1,587 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.VirtualOverride;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaOverride;
-import org.eclipse.jpt.core.context.java.JavaOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaReadOnlyOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualOverride;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.OverrideAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJarFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJarFile.java
deleted file mode 100644
index 7fb9643fe1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJarFile.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JarFile;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java
deleted file mode 100644
index a8a0c92ccd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaOverrideRelationship;
-import org.eclipse.jpt.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOverride;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
deleted file mode 100644
index 1e5ad46ec0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaReadOnlyAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.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.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.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
deleted file mode 100644
index 630a6b98eb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaVirtualAttributeOverride;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOverride;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
deleted file mode 100644
index 2040904a56..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaReadOnlyAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualAttributeOverride;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaBasicMapping.java
deleted file mode 100644
index 324b72344a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaBasicMapping.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBasicMapping;
-
-public class GenericJavaBasicMapping
- extends AbstractJavaBasicMapping
-{
- public GenericJavaBasicMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaCascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaCascade.java
deleted file mode 100644
index df0ed1c54b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaCascade.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaRelationshipMapping;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCascade2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaColumn.java
deleted file mode 100644
index d57f78f60c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaColumn.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
deleted file mode 100644
index 2e45447789..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddable.java
deleted file mode 100644
index 17602aec4a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddable.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEmbeddable;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
deleted file mode 100644
index 8f6d17ec08..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.MappingKeys;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.EmbeddedIdMapping2_0;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
deleted file mode 100644
index 7102f4addd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * 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.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.core.MappingKeys;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.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.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java
deleted file mode 100644
index 146c42f463..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
-import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.Cacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java
deleted file mode 100644
index beb9b35bac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.EnumType;
-import org.eclipse.jpt.core.context.EnumeratedConverter;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
deleted file mode 100644
index ca5b001eb4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.GenerationType;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java
deleted file mode 100644
index 34aae5975d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.Generator;
-import org.eclipse.jpt.core.context.java.JavaGenerator;
-import org.eclipse.jpt.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaIdMapping.java
deleted file mode 100644
index 03e8a282da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaIdMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaIdMapping;
-
-
-public class GenericJavaIdMapping
- extends AbstractJavaIdMapping
-{
- public GenericJavaIdMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
deleted file mode 100644
index 51ebe5459a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaBaseColumn;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.core.internal.context.java.JavaJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-
-/**
- * Java join column
- */
-public class GenericJavaJoinColumn
- extends AbstractJavaBaseColumn<JoinColumnAnnotation, JavaJoinColumn.Owner>
- implements JavaJoinColumn
-{
- /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(JavaJpaContextNode, org.eclipse.jpt.core.context.java.JavaNamedColumn.Owner, org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java
deleted file mode 100644
index 295231e990..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaJoinTable.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.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.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.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.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java
deleted file mode 100644
index bcd465f472..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaLobConverter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.LobConverter;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java
deleted file mode 100644
index d8caec70c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToManyMapping;
-
-public class GenericJavaManyToManyMapping
- extends AbstractJavaManyToManyMapping
-{
- public GenericJavaManyToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java
deleted file mode 100644
index d95dbb4093..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToOneMapping;
-
-public class GenericJavaManyToOneMapping
- extends AbstractJavaManyToOneMapping
-{
- public GenericJavaManyToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java
deleted file mode 100644
index fef0de7198..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaMappedSuperclass;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
deleted file mode 100644
index 95be82228d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumn.Owner;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.java.JavaMappingJoinTableRelationship;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa1.context.InverseJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinTableValidator;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
deleted file mode 100644
index 9b675edc6d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
deleted file mode 100644
index d155798676..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
deleted file mode 100644
index 57687fe777..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java
deleted file mode 100644
index 6f35ee3cbb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToManyMapping;
-
-public class GenericJavaOneToManyMapping
- extends AbstractJavaOneToManyMapping
-{
- public GenericJavaOneToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java
deleted file mode 100644
index 33ff6c6047..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToOneMapping;
-
-public class GenericJavaOneToOneMapping
- extends AbstractJavaOneToOneMapping
-{
- public GenericJavaOneToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
deleted file mode 100644
index 0fa856f759..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOrderable.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.jpa2.context.OrderColumnValidator;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
deleted file mode 100644
index 4b4c261fb8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.OverrideRelationship;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyOverrideRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.GenericJavaOverrideJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOverrideRelationship2_0;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
deleted file mode 100644
index 9f4a3aff06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericPersistentAttributeValidator;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java
deleted file mode 100644
index 51769d611a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPersistentType.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.core.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
deleted file mode 100644
index 4a825affaa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.java.JavaBaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.core.internal.context.java.JavaPrimaryKeyJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-
-/**
- * Java primary key join column
- */
-public class GenericJavaPrimaryKeyJoinColumn
- extends AbstractJavaNamedColumn<PrimaryKeyJoinColumnAnnotation, JavaBaseJoinColumn.Owner>
- implements JavaPrimaryKeyJoinColumn
-{
- /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(org.eclipse.jpt.core.context.java.JavaJpaContextNode, org.eclipse.jpt.core.context.java.JavaNamedColumn.Owner, org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
deleted file mode 100644
index 51470efd1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.NamedNativeQuery;
-import org.eclipse.jpt.core.context.NamedQuery;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryHint.java
deleted file mode 100644
index 7a85fdfb59..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaQueryHint.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaQuery;
-import org.eclipse.jpt.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaReferenceTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
deleted file mode 100644
index 9250f4d9c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyReferenceTable;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaReferenceTable;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.ReferenceTableAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
deleted file mode 100644
index 373111451d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-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.core.context.java.JavaJpaContextNode, org.eclipse.jpt.core.context.Table.Owner, org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java
deleted file mode 100644
index 47b68338d6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaSequenceGenerator;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java
deleted file mode 100644
index 8199658513..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTable.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaEntity;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core.context.Entity#getDefaultSchema()}<br>
- * check inheritance; get default schema from root
- * <li>{@link org.eclipse.jpt.core.context.orm.EntityMappings#getSchema()}<br>
- * check for specified schema
- * <li>{@link org.eclipse.jpt.core.context.persistence.PersistenceUnit#getDefaultSchema()}<br>
- * {@link org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults#getSchema()}
- * <li>{@link org.eclipse.jpt.core.JpaProject#getDefaultSchema()}<br>
- * check for user override project setting
- * <li>{@link org.eclipse.jpt.db.Catalog#getDefaultSchema()}<br>
- * or {@link org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
deleted file mode 100644
index 014178152e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
+++ /dev/null
@@ -1,567 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaGenerator;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.db.Database;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.SchemaContainer;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * 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.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java
deleted file mode 100644
index 8bcd205796..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTransientMapping.java
deleted file mode 100644
index cc6dc74f3c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaTransientMapping.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
deleted file mode 100644
index 959c3608ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaReadOnlyUniqueConstraint;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVersionMapping.java
deleted file mode 100644
index 47c50a4b9d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVersionMapping.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaVersionMapping;
-
-public class GenericJavaVersionMapping
- extends AbstractJavaVersionMapping
-{
- public GenericJavaVersionMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java
deleted file mode 100644
index f3c8542c7c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualOverrideRelationship;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java
deleted file mode 100644
index 454fc7f35a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaVirtualAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java
deleted file mode 100644
index 747e78aa04..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaVirtualColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java
deleted file mode 100644
index 33b73a8a41..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 92153f5268..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumnRelationship;
-import org.eclipse.jpt.core.context.JoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaReadOnlyAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinColumnRelationship;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaVirtualOverrideRelationship;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
deleted file mode 100644
index c0cf96c3ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.OverrideRelationship;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaVirtualRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java
deleted file mode 100644
index 88ab94249b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaVirtualUniqueConstraint;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaConverter.java
deleted file mode 100644
index bddc419dc7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaConverter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 8ce7cb16fd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnRelationship;
-import org.eclipse.jpt.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-/**
- * Used by
- * {@link org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java
deleted file mode 100644
index 949699667e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumn.Owner;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationship;
-import org.eclipse.jpt.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmConverter.java
deleted file mode 100644
index 7782512ee8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmConverter.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmOverride.java
deleted file mode 100644
index 2dae8d3f18..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmOverride.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.core.context.orm.OrmOverride;
-import org.eclipse.jpt.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.OrmOverrideTextRangeResolver;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
deleted file mode 100644
index 0b4b221421..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.VirtualOverride;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmOverride;
-import org.eclipse.jpt.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyOverride;
-import org.eclipse.jpt.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlOverride;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-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.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java
deleted file mode 100644
index 7fd8a3c724..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmOverride;
-import org.eclipse.jpt.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericEntityMappings.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericEntityMappings.java
deleted file mode 100644
index c8963f74a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericEntityMappings.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.internal.context.orm.AbstractEntityMappings;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
deleted file mode 100644
index 063f8272a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmOverrideRelationship;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
deleted file mode 100644
index 77f80f150b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
deleted file mode 100644
index d9bd27dc6e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
deleted file mode 100644
index 54d2336a78..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
deleted file mode 100644
index 707b8d5b49..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBasicMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmCascade.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmCascade.java
deleted file mode 100644
index ccd6ec74bc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmCascade.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Cascade;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.Cascade2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCascade2_0;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.jpt.core.resource.orm.CascadeType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java
deleted file mode 100644
index d535219959..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmColumn.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
deleted file mode 100644
index cd45365df0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.DiscriminatorType;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
deleted file mode 100644
index cab53c1c18..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEmbeddable;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
deleted file mode 100644
index 100a9e9ab1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.EmbeddedIdMapping2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
deleted file mode 100644
index 51a5feb364..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * 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.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.core.MappingKeys;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumn.Owner;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.SubIteratorWrapper;
-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.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java
deleted file mode 100644
index 22426914f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEntity;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.NullOrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.Cacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
deleted file mode 100644
index 8dfee44526..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Converter;
-import org.eclipse.jpt.core.context.EnumType;
-import org.eclipse.jpt.core.context.EnumeratedConverter;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmEnumeratedConverter;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
deleted file mode 100644
index 4c52ca3a8d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.GenerationType;
-import org.eclipse.jpt.core.context.Generator;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
deleted file mode 100644
index d581bfbc33..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.Generator;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmGenerator;
-import org.eclipse.jpt.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlGeneratorContainer;
-import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.utility.internal.StringTools;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
deleted file mode 100644
index 5c092f191a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmIdMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
deleted file mode 100644
index 67aeefa4b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmBaseColumn;
-import org.eclipse.jpt.core.internal.context.orm.OrmJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-
-/**
- * <code>orm.xml</code> join column
- */
-public class GenericOrmJoinColumn
- extends AbstractOrmBaseColumn<XmlJoinColumn, OrmJoinColumn.Owner>
- implements OrmJoinColumn
-{
- /** @see org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.core.context.orm.OrmNamedColumn.Owner, org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
deleted file mode 100644
index bc84b6d7b9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-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.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.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.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.db.Table resolveDbTable(String tableName) {
- org.eclipse.jpt.db.Table dbTable = super.resolveDbTable(tableName);
- return (dbTable != null) ? dbTable : this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public org.eclipse.jpt.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.db.Table resolveDbTable(String tableName) {
- org.eclipse.jpt.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.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
deleted file mode 100644
index 73dc8bcfc8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Converter;
-import org.eclipse.jpt.core.context.LobConverter;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmLobConverter;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
deleted file mode 100644
index 7d9b1fe36d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmManyToManyMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
deleted file mode 100644
index 9510b36347..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmManyToOneMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
deleted file mode 100644
index 4bac493423..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmMappedSuperclass;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
deleted file mode 100644
index 0ad583aa0d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
deleted file mode 100644
index 0ad7af06f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
deleted file mode 100644
index e20af19271..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
deleted file mode 100644
index beeb4130c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmOneToManyMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
deleted file mode 100644
index c60237549e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmOneToOneMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
deleted file mode 100644
index 7f404434a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOrderable.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.jpa2.context.OrderColumnValidator;
-import org.eclipse.jpt.core.jpa2.context.OrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.core.resource.orm.XmlOrderable;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
deleted file mode 100644
index f0bcef9b06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.OverrideRelationship;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.MappedByRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyOverrideRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmOverrideJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.orm.NullOrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.GenericOrmOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOverrideRelationship2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java
deleted file mode 100644
index 4caf7cb98a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitMetadata;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistenceUnitDefaults2_0;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.db.Catalog;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java
deleted file mode 100644
index 90c3391728..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistenceUnitMetadata2_0;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
deleted file mode 100644
index 834fa71582..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.orm.SpecifiedOrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericPersistentAttributeValidator;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
deleted file mode 100644
index 49b0cec9ac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
+++ /dev/null
@@ -1,1195 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentType2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistentType2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.core.resource.xml.EmfTools;
-import org.eclipse.jpt.utility.internal.ClassName;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.ChainIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterables.SnapshotCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-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) {
- JptCorePlugin.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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
deleted file mode 100644
index cb8b1a5e1d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.core.internal.context.orm.OrmPrimaryKeyJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.db.Column;
-import org.eclipse.jpt.db.Table;
-
-/**
- * <code>orm.xml</code> primary key join column
- */
-public class GenericOrmPrimaryKeyJoinColumn
- extends AbstractOrmNamedColumn<XmlPrimaryKeyJoinColumn, OrmBaseJoinColumn.Owner>
- implements OrmPrimaryKeyJoinColumn
-{
- /** @see org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.core.context.orm.OrmNamedColumn.Owner, org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
deleted file mode 100644
index 77e2b7ea55..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.NamedNativeQuery;
-import org.eclipse.jpt.core.context.NamedQuery;
-import org.eclipse.jpt.core.context.Query;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmQuery;
-import org.eclipse.jpt.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.core.resource.orm.XmlQueryContainer;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryHint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
deleted file mode 100644
index 7b5a6fed0f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmQuery;
-import org.eclipse.jpt.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
deleted file mode 100644
index d7330b2aae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Vector;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyReferenceTable;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmReferenceTable;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.core.resource.orm.AbstractXmlReferenceTable;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
deleted file mode 100644
index eeb60b6697..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.context.BaseJoinColumn;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlySecondaryTable;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmBaseJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-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.core.context.XmlContextNode, org.eclipse.jpt.core.context.Table.Owner, org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
deleted file mode 100644
index db655a961f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmSequenceGenerator;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTable.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTable.java
deleted file mode 100644
index 00f847850b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTable.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
deleted file mode 100644
index aaf7e23df6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmGenerator;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.db.Schema;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * <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.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.<String>instance();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
deleted file mode 100644
index 3f33f72c8f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Converter;
-import org.eclipse.jpt.core.context.TemporalConverter;
-import org.eclipse.jpt.core.context.TemporalType;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
deleted file mode 100644
index b49a5493a3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
deleted file mode 100644
index d10134713f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
deleted file mode 100644
index 3208ef5638..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmVersionMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java
deleted file mode 100644
index 8f66c06cef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java
deleted file mode 100644
index 0339f1bd5d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java
deleted file mode 100644
index c9e1920168..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.orm.OrmVirtualColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java
deleted file mode 100644
index 6a946ab997..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JpaContextNode;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
deleted file mode 100644
index 862285fc10..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.OverrideRelationship;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.orm.OrmVirtualRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmVirtualOverrideJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java
deleted file mode 100644
index 2840ea6490..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java
deleted file mode 100644
index 6147b1a869..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.UniqueConstraint;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmVirtualUniqueConstraint;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXml.java
deleted file mode 100644
index 7c254aad0d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXml.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.JpaFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.orm.EntityMappings;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmXml;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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.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(JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
deleted file mode 100644
index 8a697dc1ef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.orm.NullOrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.core.internal.GenericJpaPlatformProvider;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.orm.GenericOrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.context.orm.OrmBasicMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddableDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEntityDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmManyToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmManyToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmMappedSuperclassDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmOneToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmOneToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmTransientMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmVersionMappingDefinition;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-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 JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/NullOrmConverter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/NullOrmConverter.java
deleted file mode 100644
index ac60939a10..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/NullOrmConverter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.Converter;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
deleted file mode 100644
index f341a71752..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.orm;
-
-import java.util.ListIterator;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.context.RelationshipMapping;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnRelationship;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-/**
- * Used by
- * {@link org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
deleted file mode 100644
index 2f50527aea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericClassRef.java
deleted file mode 100644
index 5bab62bebb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericClassRef.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.persistence.ClassRef;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-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) {
- JptCorePlugin.log(t);
- }
- }
-
- public TextRange getValidationTextRange() {
- return this.isVirtual() ? null : this.xmlJavaClassRef.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericJarFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericJarFileRef.java
deleted file mode 100644
index 80b33e73c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericJarFileRef.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractJarFileRef;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
deleted file mode 100644
index 90109a0a83..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java
deleted file mode 100644
index d5b77632aa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistence.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.persistence.Persistence2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementListIterable;
-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(
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java
deleted file mode 100644
index 97cd5487fa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java
deleted file mode 100644
index 2ace41645a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.resource.persistence.XmlProperty;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
deleted file mode 100644
index 429174fc44..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core.JpaFile;
-import org.eclipse.jpt.core.JpaStructureNode;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.persistence.Persistence2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceXml2_0;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.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.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(JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
deleted file mode 100644
index 070f577b06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.context.persistence.GenericPersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.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 JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java
deleted file mode 100644
index ea5c1e029b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractMappingFileRef;
-import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.utility.internal.StringTools;
-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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
deleted file mode 100644
index 2837174908..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java
deleted file mode 100644
index 6648edb213..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java
deleted file mode 100644
index 37d45f454e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
deleted file mode 100644
index 3ddb0353c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
deleted file mode 100644
index 573dfee8ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
deleted file mode 100644
index 955f2887bf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java
deleted file mode 100644
index 9adad225b6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
deleted file mode 100644
index 78804ceaf9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.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.core.internal.resource.java.source.SourceNamedQueryAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
deleted file mode 100644
index 40396ec074..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
deleted file mode 100644
index 3d80fdb5fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.internal.AbstractJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.Access2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.AssociationOverride2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.AssociationOverrides2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.Cacheable2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.CollectionTable2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.ElementCollection2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.MapKeyClass2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.MapKeyColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.MapKeyEnumerated2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.MapKeyJoinColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.MapKeyJoinColumns2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.MapKeyTemporal2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.MapsId2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.NamedQueries2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.NamedQuery2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.SequenceGenerator2_0AnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.BasicAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EmbeddedIdAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EntityAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.EnumeratedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.GeneratedValueAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.IdClassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.InheritanceAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.JoinTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.LobAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ManyToManyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.ManyToOneAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MapKeyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OneToManyAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OneToOneAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.OrderByAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.SecondaryTablesAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TableGeneratorAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TemporalAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.TransientAnnotationDefinition;
-import org.eclipse.jpt.core.internal.resource.java.VersionAnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
deleted file mode 100644
index d3f3bf9a9f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import org.eclipse.jpt.core.JpaFacet;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformFactory;
-import org.eclipse.jpt.core.JpaPlatformVariation;
-import org.eclipse.jpt.core.internal.GenericJpaAnnotationProvider;
-import org.eclipse.jpt.core.internal.GenericJpaPlatform;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
deleted file mode 100644
index f551773741..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import 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.core.JpaPlatformProvider;
-import org.eclipse.jpt.core.JpaResourceModelProvider;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.ResourceDefinition;
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.core.internal.AbstractJpaPlatformProvider;
-import org.eclipse.jpt.core.internal.JarResourceModelProvider;
-import org.eclipse.jpt.core.internal.JavaResourceModelProvider;
-import org.eclipse.jpt.core.internal.OrmResourceModelProvider;
-import org.eclipse.jpt.core.internal.PersistenceResourceModelProvider;
-import org.eclipse.jpt.core.internal.context.java.JavaBasicMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddableDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaEntityDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaMappedSuperclassDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.JavaVersionMappingDefinition;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaElementCollectionMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaEmbeddedMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaIdMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaManyToManyMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaManyToOneMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaOneToManyMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.JavaOneToOneMappingDefinition2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.Generic2_0PersistenceXmlDefinition;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * 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(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
deleted file mode 100644
index 726704938b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import java.util.Iterator;
-
-import org.eclipse.jpt.core.JpaDataSource;
-import org.eclipse.jpt.core.context.JpaRootContextNode;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java
deleted file mode 100644
index bf649ed74b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericJpaFactory2_0.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import org.eclipse.jpt.core.JpaDataSource;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JpaProject.Config;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.core.context.java.JavaOrderable;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.core.internal.AbstractJpaFactory;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaColumn;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaOrderable;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaCacheable2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaCollectionTable2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaDerivedIdentity2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaNamedQuery2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaOrphanRemoval2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaPersistentType2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.core.jpa2.context.Orderable2_0.Owner;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/GenericMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericMetamodelSynchronizer.java
deleted file mode 100644
index 825b2fb068..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/GenericMetamodelSynchronizer.java
+++ /dev/null
@@ -1,432 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2;
-
-import 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.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.utility.internal.ClassName;
-import org.eclipse.jpt.utility.internal.SimpleStack;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/CollectionTableValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/CollectionTableValidator.java
deleted file mode 100644
index cdbe70b90a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/CollectionTableValidator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context;
-
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.AbstractTableValidator;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/OrderColumnValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/OrderColumnValidator.java
deleted file mode 100644
index 055b1455ab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/OrderColumnValidator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context;
-
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.AbstractNamedColumnValidator;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/SimpleMetamodelField.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/SimpleMetamodelField.java
deleted file mode 100644
index 4615c38895..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/SimpleMetamodelField.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context;
-
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
deleted file mode 100644
index 7b66b6291e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
+++ /dev/null
@@ -1,1530 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFactory;
-import org.eclipse.jpt.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumn.Owner;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaConverter;
-import org.eclipse.jpt.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.core.internal.jpa2.context.CollectionTableValidator;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.context.CollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.Association;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.SimpleAssociation;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-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.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.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java
deleted file mode 100644
index 39d36af494..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.JpaFactory;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java
deleted file mode 100644
index dd43441a7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
deleted file mode 100644
index 552d3234cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
deleted file mode 100644
index 48f327a2d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.java.GenericJavaReferenceTable;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * 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.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.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
deleted file mode 100644
index f17723fe52..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.DerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.utility.Filter;
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
deleted file mode 100644
index 05dc4893bc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java
deleted file mode 100644
index ed63801e13..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEmbeddable;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
deleted file mode 100644
index 0485c7a35e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
deleted file mode 100644
index eeada2d706..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
deleted file mode 100644
index 2a9c6370dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.core.jpa2.context.LockModeType2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaNamedQuery2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
deleted file mode 100644
index dbe914b668..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java
deleted file mode 100644
index 392055b18b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java
deleted file mode 100644
index 82846ed9e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOverrideRelationship2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java
deleted file mode 100644
index 9f21d4b6d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericPersistentAttributeValidator;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
deleted file mode 100644
index d36bd53f6c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.context.AccessType;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.core.jpa2.context.java.JavaPersistentType2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * JPA 2.0 Java persistent type.
- * Support for specified access and metamodel generation.
- */
-public class GenericJavaPersistentType2_0
- extends AbstractJavaPersistentType
- implements JavaPersistentType2_0
-{
- protected 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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java
deleted file mode 100644
index d5fe665817..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaSequenceGenerator;
-import org.eclipse.jpt.core.jpa2.context.java.JavaSequenceGenerator2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java
deleted file mode 100644
index 4c22eb15b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.JoinTableRelationship;
-import org.eclipse.jpt.core.context.JoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinTable;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinTableRelationship;
-import org.eclipse.jpt.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
deleted file mode 100644
index f9e2bd998d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
deleted file mode 100644
index c563e1d05d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaEmbeddedMappingDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java
deleted file mode 100644
index 0f96f30248..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
deleted file mode 100644
index 6a6b94dd14..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToManyMappingDefinition;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java
deleted file mode 100644
index d39093bb4b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaManyToOneMappingDefinition;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
deleted file mode 100644
index 2b62dfc69e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToManyMappingDefinition;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java
deleted file mode 100644
index d7b8aae6ea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaOneToOneMappingDefinition;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaCacheable2_0.java
deleted file mode 100644
index 6131504709..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaCacheable2_0.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java
deleted file mode 100644
index 65ac64452a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.java.JavaSingleRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.DerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
deleted file mode 100644
index 67f4f8ffd6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.core.context.java.JavaColumn;
-import org.eclipse.jpt.core.context.java.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.db.Table;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- *
- */
-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.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java
deleted file mode 100644
index c8a08dfa3d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
deleted file mode 100644
index 77ad929d4e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
+++ /dev/null
@@ -1,1592 +0,0 @@
-/*******************************************************************************
- * 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.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.core.context.AssociationOverride;
-import org.eclipse.jpt.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.AttributeOverride;
-import org.eclipse.jpt.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.core.context.BaseColumn;
-import org.eclipse.jpt.core.context.Column;
-import org.eclipse.jpt.core.context.Converter;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.FetchType;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.JoinColumn.Owner;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.OverrideContainer;
-import org.eclipse.jpt.core.context.Override_;
-import org.eclipse.jpt.core.context.PersistentType;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmColumn;
-import org.eclipse.jpt.core.context.orm.OrmConverter;
-import org.eclipse.jpt.core.context.orm.OrmEnumeratedConverter;
-import org.eclipse.jpt.core.context.orm.OrmLobConverter;
-import org.eclipse.jpt.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.MapKeyColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.NullOrmConverter;
-import org.eclipse.jpt.core.internal.jpa2.context.CollectionTableValidator;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.context.CollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.core.resource.orm.Attributes;
-import org.eclipse.jpt.core.resource.orm.MapKey;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.core.resource.orm.XmlClassReference;
-import org.eclipse.jpt.core.resource.orm.XmlCollectionTable;
-import org.eclipse.jpt.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.Transformer;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.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.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.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java
deleted file mode 100644
index 4a6e0eb873..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
deleted file mode 100644
index 64a3d715a4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import java.util.Iterator;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.NamedColumn;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.core.context.TypeMapping;
-import org.eclipse.jpt.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
-import org.eclipse.jpt.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmReferenceTable;
-import org.eclipse.jpt.core.jpa2.context.CollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlCollectionTable;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * <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.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.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
deleted file mode 100644
index 01c21903af..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.DerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
deleted file mode 100644
index 9b63abc788..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the terms of
- * the Eclipse Public License v1.0, which accompanies this distribution and is available at
- * http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java
deleted file mode 100644
index 08f2005b2d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEmbeddable;
-import org.eclipse.jpt.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java
deleted file mode 100644
index fc821c5aea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java
deleted file mode 100644
index e3ccc58a13..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.MappingKeys;
-import org.eclipse.jpt.core.context.AttributeMapping;
-import org.eclipse.jpt.core.context.Embeddable;
-import org.eclipse.jpt.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.Tools;
-import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
deleted file mode 100644
index 84bbfa4049..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.core.jpa2.context.LockModeType2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmNamedQuery2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
deleted file mode 100644
index dac68c619b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.PersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java
deleted file mode 100644
index 052962d635..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java
deleted file mode 100644
index 9a65dfb553..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinColumn;
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java
deleted file mode 100644
index db8b9c7219..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.AccessType;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.JptValidator;
-import org.eclipse.jpt.core.internal.context.orm.SpecifiedOrmPersistentAttribute;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericPersistentAttributeValidator;
-import org.eclipse.jpt.core.resource.orm.XmlAccessHolder;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java
deleted file mode 100644
index c586971351..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmSequenceGenerator;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSequenceGenerator2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java
deleted file mode 100644
index f2fca28004..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.context.JoinTable;
-import org.eclipse.jpt.core.context.JoinTableRelationship;
-import org.eclipse.jpt.core.context.JoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.context.Relationship;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinTable;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinTableRelationship;
-import org.eclipse.jpt.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.core.internal.context.MappingTools;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java
deleted file mode 100644
index 967d08e68d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.core.context.Table;
-import org.eclipse.jpt.core.context.XmlContextNode;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.context.orm.OrmAssociationOverrideContainer.Owner;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer;
-import org.eclipse.jpt.core.internal.jpa1.context.orm.GenericOrmOrderable;
-import org.eclipse.jpt.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCollectionTable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
deleted file mode 100644
index 805c373b24..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import java.util.ArrayList;
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.orm.NullOrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmBasicMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddableDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEmbeddedMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmEntityDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmIdMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmManyToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmManyToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmMappedSuperclassDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmOneToManyMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmOneToOneMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmTransientMappingDefinition;
-import org.eclipse.jpt.core.internal.context.orm.OrmVersionMappingDefinition;
-import org.eclipse.jpt.core.internal.jpa2.Generic2_0JpaPlatformProvider;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-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 JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java
deleted file mode 100644
index caf80e4cc6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java
deleted file mode 100644
index d40c5172f9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.AbstractXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.DerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java
deleted file mode 100644
index 07c894a69e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java
deleted file mode 100644
index eabc7caf7b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
deleted file mode 100644
index e810ba8343..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.connection.GenericConnection2_0;
-import org.eclipse.jpt.core.internal.jpa2.context.persistence.options.GenericOptions2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java
deleted file mode 100644
index dc4366c1ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
-import org.eclipse.jpt.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 JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java
deleted file mode 100644
index 48f975c8b0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence.connection;
-
-import java.util.Map;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
deleted file mode 100644
index 2e7130f1d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence.connection;
-
-import java.util.Map;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java
deleted file mode 100644
index 1d73540371..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence.options;
-
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
deleted file mode 100644
index de1c93dd74..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.context.persistence.options;
-
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.core.jpa2.context.persistence.options.JpaOptions2_0;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
deleted file mode 100644
index f4a861e421..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryAccess2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceAccess2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
deleted file mode 100644
index aa611b2372..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryAssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceAssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java
deleted file mode 100644
index 22521a3721..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryAssociationOverrides2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceAssociationOverrides2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
deleted file mode 100644
index 782d401f4a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryCacheable2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceCacheable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
deleted file mode 100644
index d39980b0cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryCollectionTable2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceCollectionTable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
deleted file mode 100644
index 0f93a4d664..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryElementCollection2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceElementCollection2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
deleted file mode 100644
index 77bee5e7cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryGeneratedAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceGeneratedAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
deleted file mode 100644
index 05416d211a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryMapKeyClass2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceMapKeyClass2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
deleted file mode 100644
index bffaa00e08..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryMapKeyColumn2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceMapKeyColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
deleted file mode 100644
index e636d9667e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryMapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceMapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
deleted file mode 100644
index 82e4ac4d98..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
deleted file mode 100644
index b3fcf81a94..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
deleted file mode 100644
index 8bc748e17d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryMapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceMapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
deleted file mode 100644
index 63239fb6f3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryMapsId2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceMapsId2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java
deleted file mode 100644
index 474b998afc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryNamedQueries2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceNamedQueries2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
deleted file mode 100644
index 17c6b54865..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryNamedQuery2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceNamedQuery2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
deleted file mode 100644
index 6c5d07a12a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java
deleted file mode 100644
index c220f9c010..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jpt.core.internal.resource.java.NullJoinTableAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
deleted file mode 100644
index f1c3ba5c34..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.internal.resource.java.NullBaseTableAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
deleted file mode 100644
index 0fdc9daa97..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.resource.java.NullBaseColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
deleted file mode 100644
index 58e7396dbc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.core.resource.java.EnumType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
deleted file mode 100644
index 9c6cddfd27..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
deleted file mode 100644
index 2ab97c1a68..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
deleted file mode 100644
index 3f855d8caa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.resource.java.NullNamedColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
deleted file mode 100644
index 87f5453b2e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryOrderColumn2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceOrderColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
deleted file mode 100644
index 7c0ef25d73..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinarySequenceGenerator2_0Annotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceSequenceGenerator2_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java
deleted file mode 100644
index 11760f7c4e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.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.core.internal.resource.java.source.SourceBaseJoinColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java
deleted file mode 100644
index cb6e2865ef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import 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.core.internal.resource.java.source.AnnotationContainerTools;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
deleted file mode 100644
index 7694a8dcea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.binary.BinaryStaticMetamodelAnnotation;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.source.SourceStaticMetamodelAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
deleted file mode 100644
index d8d9608e24..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
deleted file mode 100644
index 15b8e34519..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.NullJoinTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java
deleted file mode 100644
index d47f13bc82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
deleted file mode 100644
index 8fa18f79ee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
deleted file mode 100644
index 1465decdd4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryBaseTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
deleted file mode 100644
index df15c93f52..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
deleted file mode 100644
index e9f51b48b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.annotation.Generated
- */
-public final class BinaryGeneratedAnnotation
- extends BinaryAnnotation
- implements GeneratedAnnotation
-{
- private final Vector<String> values;
- private String date;
- private String comments;
-
-
- public BinaryGeneratedAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.values = this.buildValues();
- this.date = this.buildDate();
- this.comments = this.buildComments();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateValues();
- this.setDate_(this.buildDate());
- this.setComments_(this.buildComments());
- }
-
- // TODO
- private void updateValues() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** GeneratedAnnotation implementation **********
-
- // ***** values
- public ListIterator<String> values() {
- return new CloneListIterator<String>(this.values);
- }
-
- public int valuesSize() {
- return this.values.size();
- }
-
- 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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
deleted file mode 100644
index e50d30d6a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
deleted file mode 100644
index 34d7192cbb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryCompleteColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
deleted file mode 100644
index 34b8d1dfb6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryBaseEnumeratedAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
deleted file mode 100644
index a08c62aeb3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryBaseJoinColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java
deleted file mode 100644
index 0f9bf96948..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryContainerAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
deleted file mode 100644
index 051d689227..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryBaseTemporalAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
deleted file mode 100644
index 1dea4c7069..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java
deleted file mode 100644
index a3ce6961a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
deleted file mode 100644
index 219e342948..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.LockModeType_2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
deleted file mode 100644
index 2635b2589d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.binary.BinaryNamedColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
deleted file mode 100644
index 9fb75d42c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
deleted file mode 100644
index 8c7e01c4f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * javax.persistence.metamodel.StaticMetamodel
- */
-public final class BinaryStaticMetamodelAnnotation
- extends BinaryAnnotation
- implements StaticMetamodelAnnotation
-{
- private String value;
-
-
- public BinaryStaticMetamodelAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** StaticMetamodelAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA2_0.STATIC_METAMODEL__VALUE);
- }
-
- // ***** fully-qualified class name
- /**
- * binary is already fully-qualified
- */
- public String getFullyQualifiedClassName() {
- return this.value;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
deleted file mode 100644
index f333679d1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.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.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
deleted file mode 100644
index 2d14bb3763..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import java.util.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.core.internal.jpa2.resource.java.NullAssociationOverrideJoinTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinTableAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java
deleted file mode 100644
index ac852de058..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
deleted file mode 100644
index c70d351d1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.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.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
deleted file mode 100644
index 2bd601df32..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import java.util.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.core.internal.resource.java.source.AnnotationContainerTools;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceBaseTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
deleted file mode 100644
index 3774ac166c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.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.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.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.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
deleted file mode 100644
index 8e6f60e206..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import java.util.Arrays;
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.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.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * javax.annotation.Generated
- */
-public final class SourceGeneratedAnnotation
- extends SourceAnnotation<Type>
- implements GeneratedAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String[]> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String[]> valueAdapter;
- private final Vector<String> values = new Vector<String>();
-
- private static final DeclarationAnnotationElementAdapter<String> DATE_ADAPTER = buildAdapter(DATE_ELEMENT_NAME);
- private final AnnotationElementAdapter<String> dateAdapter;
- private String date;
-
- private static final DeclarationAnnotationElementAdapter<String> COMMENTS_ADAPTER = buildAdapter(COMMENTS_ELEMENT_NAME);
- private final AnnotationElementAdapter<String> commentsAdapter;
- private String comments;
-
-
- public SourceGeneratedAnnotation(JavaResourcePersistentType parent, Type type) {
- super(parent, type, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER);
- this.dateAdapter = this.buildAdapter(DATE_ADAPTER);
- this.commentsAdapter = this.buildAdapter(COMMENTS_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- private AnnotationElementAdapter<String[]> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String[]> daea) {
- return new 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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
deleted file mode 100644
index 120a1038c2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.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.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.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.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
deleted file mode 100644
index d965ff07db..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.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.core.internal.resource.java.source.SourceCompleteColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
deleted file mode 100644
index 46eb6f32a4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.source.SourceBaseEnumeratedAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
deleted file mode 100644
index 016b5df17c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.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.core.internal.resource.java.source.SourceBaseTemporalAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
deleted file mode 100644
index 28d4a1ad65..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.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.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java
deleted file mode 100644
index 443b6998bf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
deleted file mode 100644
index d1a2d9e6cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import java.util.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.core.internal.resource.java.source.SourceNamedQueryAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.LockModeType_2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
deleted file mode 100644
index b5841f54ee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import java.util.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.core.internal.resource.java.source.SourceNamedColumnAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
deleted file mode 100644
index 31a4804d8f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.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.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
deleted file mode 100644
index 97eb0a066f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.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.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-
-/**
- * javax.persistence.metamodel.StaticMetamodel
- */
-public final class 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.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.core/src/org/eclipse/jpt/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java
deleted file mode 100644
index a2d3f1fcd9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.libprov;
-
-import org.eclipse.jpt.common.core.internal.libprov.JptOsgiBundlesLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java
deleted file mode 100644
index 8081bc1767..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.libprov;
-
-import org.eclipse.jpt.common.core.internal.libprov.JptUserLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/libprov/LegacyJpaLibraryProviderDetector.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/LegacyJpaLibraryProviderDetector.java
deleted file mode 100644
index 398ddce2ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/LegacyJpaLibraryProviderDetector.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.libprov;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java
deleted file mode 100644
index a6dc73b030..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java
deleted file mode 100644
index 4a1172ec28..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.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, JptCorePlugin.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, JptCorePlugin.PLUGIN_ID, message);
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
deleted file mode 100644
index 8780fff101..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFacet;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/libval/GenericJpaUserLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/GenericJpaUserLibraryValidator.java
deleted file mode 100644
index 5edd181492..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/libval/GenericJpaUserLibraryValidator.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFacet;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
deleted file mode 100644
index e2c6aefc03..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFacet;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.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, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_PROJECT_NOT_JPA);
- }
- if (! hasSupportedPlatform(project)) {
- // verifies project has platform that supports this file type
- return new Status(
- IStatus.ERROR, JptCorePlugin.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, JptCorePlugin.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, JptCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED);
- }
- try {
- String jpaFacetVersion = getJpaFacetVersion(getProject());
- if (! fileVersionSupportedForFacetVersion(fileVersion, jpaFacetVersion)) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.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 : JptCorePlugin.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 = JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java
deleted file mode 100644
index fbe7c86549..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/AbstractJpaFileCreationOperation.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.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 = JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java
deleted file mode 100644
index 2ed830e7a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/JpaFileCreationDataModelProperties.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProperties.java
deleted file mode 100644
index 4db67ed303..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProperties.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java
deleted file mode 100644
index b202b0c0f4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationDataModelProvider.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFacet;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.JPA;
-import org.eclipse.jpt.core.resource.orm.v2_0.JPA2_0;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-import org.eclipse.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 JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment();
- }
-
- @Override
- protected String getDefaultVersion() {
- if (getProject() == null) {
- return null;
- }
- JpaPlatform jpaPlatform;
- JpaProject jpaProject = getJpaProject();
- jpaPlatform = (jpaProject == null)
- ? JptCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject())
- : jpaProject.getJpaPlatform();
- return jpaPlatform.getMostRecentSupportedResourceType(JptCorePlugin.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, JptCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED, pUnitName));
- }
- if (getPersistenceUnit() == null) {
- return new Status(
- IStatus.ERROR, JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java
deleted file mode 100644
index 0d89c01966..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/OrmFileCreationOperation.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.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 = JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProperties.java
deleted file mode 100644
index 6d9c2578f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProperties.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-public interface PersistenceFileCreationDataModelProperties
- extends JpaFileCreationDataModelProperties
-{
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java
deleted file mode 100644
index ae267abef7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationDataModelProvider.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-import org.eclipse.jpt.core.JpaFacet;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.persistence.JPA;
-import org.eclipse.jpt.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 JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH.lastSegment();
- }
-
- @Override
- protected String getDefaultVersion() {
- if (getProject() == null) {
- return null;
- }
- JpaPlatform jpaPlatform;
- JpaProject jpaProject = getJpaProject();
- jpaPlatform = (jpaProject == null)
- ? JptCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject())
- : jpaProject.getJpaPlatform();
- return jpaPlatform.getMostRecentSupportedResourceType(JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationOperation.java
deleted file mode 100644
index e98e3316bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/operations/PersistenceFileCreationOperation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.operations;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.core.internal.resource.persistence.PersistenceXmlResourceProvider;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformDescriptionImpl.java
deleted file mode 100644
index ec96cb273c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformDescriptionImpl.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.platform;
-
-import org.eclipse.jpt.common.core.internal.XPointUtil;
-import org.eclipse.jpt.core.JpaFacet;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JpaPlatformFactory;
-import org.eclipse.jpt.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformGroupDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformGroupDescriptionImpl.java
deleted file mode 100644
index 3a3de3d42b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformGroupDescriptionImpl.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.platform;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jpt.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.core.platform.JpaPlatformGroupDescription;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.SuperIterableWrapper;
-
-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.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformManagerImpl.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformManagerImpl.java
deleted file mode 100644
index 16a3394d39..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JpaPlatformManagerImpl.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaFacet;
-import org.eclipse.jpt.core.JpaPlatform;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.core.platform.JpaPlatformGroupDescription;
-import org.eclipse.jpt.core.platform.JpaPlatformManager;
-import org.eclipse.jpt.utility.internal.KeyedSet;
-import org.eclipse.jpt.utility.internal.iterables.SuperIterableWrapper;
-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 = JptCorePlugin.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(JptCorePlugin.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 = JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/prefs/JpaPreferenceInitializer.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/prefs/JpaPreferenceInitializer.java
deleted file mode 100644
index fda01b3469..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/prefs/JpaPreferenceInitializer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.prefs;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jpt.core.JptCorePlugin;
-
-/**
- * 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() {
- JptCorePlugin.initializeDefaultPreferences();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
deleted file mode 100644
index a31c836073..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaProjectManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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) {
- JptCorePlugin.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 = JptCorePlugin.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
- JptCorePlugin.log(ex);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
deleted file mode 100644
index b11e68ea73..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaProjectManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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 = JptCorePlugin.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
- JptCorePlugin.log(ex);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
deleted file mode 100644
index dc5f5de333..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaProjectManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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 = JptCorePlugin.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
- JptCorePlugin.log(ex);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaCoreRefactoringMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaCoreRefactoringMessages.java
deleted file mode 100644
index 6972076869..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaCoreRefactoringMessages.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeleteMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
deleted file mode 100644
index bce7b65ef2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaProjectManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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 JptCorePlugin#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 JptCorePlugin#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 = JptCorePlugin.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 : JptCorePlugin.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
- JptCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
deleted file mode 100644
index ef39b862ff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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) {
- JptCorePlugin.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(JptCorePlugin.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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeleteTypeParticipant.java
deleted file mode 100644
index e0b7fd8dba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaDeleteTypeParticipant.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveFolderParticipant.java
deleted file mode 100644
index d96a145479..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveFolderParticipant.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaProjectManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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 = JptCorePlugin.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 : JptCorePlugin.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
- JptCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveMappingFileParticipant.java
deleted file mode 100644
index 5bddba099f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveMappingFileParticipant.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaProjectManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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 JptCorePlugin#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 JptCorePlugin#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 = JptCorePlugin.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 : JptCorePlugin.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
- JptCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveTypeParticipant.java
deleted file mode 100644
index 96f9b0bb26..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaMoveTypeParticipant.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameFolderParticipant.java
deleted file mode 100644
index 5f6e832f88..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameFolderParticipant.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaProjectManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.EmptyIterable;
-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 = JptCorePlugin.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 : JptCorePlugin.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
- JptCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameMappingFileParticipant.java
deleted file mode 100644
index 201ef60c96..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameMappingFileParticipant.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JpaProjectManager;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-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 JptCorePlugin#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 JptCorePlugin#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 = JptCorePlugin.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 : JptCorePlugin.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
- JptCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenamePackageParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenamePackageParticipant.java
deleted file mode 100644
index cff31cf88d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenamePackageParticipant.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.refactoring;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameTypeParticipant.java
deleted file mode 100644
index 0668838912..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/refactoring/JpaRenameTypeParticipant.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-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) {
- JptCorePlugin.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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/contenttypes/IndeterminateContentDescriber.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/contenttypes/IndeterminateContentDescriber.java
deleted file mode 100644
index 79cd8932d0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/contenttypes/IndeterminateContentDescriber.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * 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.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.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.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaResourceNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaResourceNode.java
deleted file mode 100644
index 4a8b77c918..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AbstractJavaResourceNode.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.resource.java;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.utility.internal.model.AspectChangeSupport;
-import org.eclipse.jpt.utility.internal.model.ChangeSupport;
-
-/**
- * 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.core.internal.resource.java.source.SourceCompilationUnit#getRoot()
- * @see org.eclipse.jpt.core.internal.resource.java.binary.BinaryPackageFragmentRoot#getRoot()
- * @see org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
deleted file mode 100644
index 3a744d08b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryAssociationOverride1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceAssociationOverride1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
deleted file mode 100644
index f78fc000a3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryAssociationOverrides1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceAssociationOverrides1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
deleted file mode 100644
index 66a41d2523..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAttributeOverrideAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
deleted file mode 100644
index ebf12b6e1a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAttributeOverridesAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceAttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/BasicAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicAnnotationDefinition.java
deleted file mode 100644
index 9476699d07..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/BasicAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryBasicAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceBasicAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnAnnotationDefinition.java
deleted file mode 100644
index 8da394aa31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
deleted file mode 100644
index 6e37799b8d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryDiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceDiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
deleted file mode 100644
index 2af57b5cf1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryDiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceDiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableAnnotationDefinition.java
deleted file mode 100644
index 3d73e9f4bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddableAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEmbeddableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedAnnotationDefinition.java
deleted file mode 100644
index 360b33325f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEmbeddedAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
deleted file mode 100644
index 2c3111ad6a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEmbeddedIdAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/EntityAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityAnnotationDefinition.java
deleted file mode 100644
index 2d770636b0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EntityAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEntityAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEntityAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedAnnotationDefinition.java
deleted file mode 100644
index c8abe7ec02..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/EnumeratedAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryEnumeratedAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceEnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
deleted file mode 100644
index eed6278958..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryGeneratedValueAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceGeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/IdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdAnnotationDefinition.java
deleted file mode 100644
index 114e69af8e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryIdAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceIdAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassAnnotationDefinition.java
deleted file mode 100644
index e0424460ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/IdClassAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryIdClassAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceIdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceAnnotationDefinition.java
deleted file mode 100644
index 37a0dd5f67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/InheritanceAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryInheritanceAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceInheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnAnnotationDefinition.java
deleted file mode 100644
index 548bedb8da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
deleted file mode 100644
index a816e31a2d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinColumnsAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableAnnotationDefinition.java
deleted file mode 100644
index d86c1a5ab6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/JoinTableAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceJoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/LobAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobAnnotationDefinition.java
deleted file mode 100644
index 289443f219..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/LobAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryLobAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceLobAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyAnnotationDefinition.java
deleted file mode 100644
index 9e9c5013da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToManyAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryManyToManyAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceManyToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneAnnotationDefinition.java
deleted file mode 100644
index 12c6966441..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/ManyToOneAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryManyToOneAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceManyToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyAnnotationDefinition.java
deleted file mode 100644
index 67c89c3748..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MapKeyAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryMapKeyAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceMapKeyAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
deleted file mode 100644
index 6ea4af81a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryMappedSuperclassAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceMappedSuperclassAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
deleted file mode 100644
index dd9df78f87..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
deleted file mode 100644
index b5ed03e050..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryNamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
deleted file mode 100644
index 34aa92ea76..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryNamedQueries1_0Annotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceNamedQueries1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryAnnotationDefinition.java
deleted file mode 100644
index a88da1ed98..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NamedQueryAnnotationDefinition.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinaryNamedQuery1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java
deleted file mode 100644
index 7ffed88a8d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAnnotation.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import java.util.Map;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java
deleted file mode 100644
index b79ebb21f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java
deleted file mode 100644
index 670d6cf465..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseColumnAnnotation.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java
deleted file mode 100644
index 6b2490f2df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullBaseTableAnnotation.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import java.util.ListIterator;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java
deleted file mode 100644
index 9af6649718..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullColumnAnnotation.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import java.util.Map;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
deleted file mode 100644
index 76ec66fc42..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
deleted file mode 100644
index 308b36a48d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java
deleted file mode 100644
index 945b86f39d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullEnumeratedAnnotation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.EnumType;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java
deleted file mode 100644
index aee4e3800f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullInheritanceAnnotation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumnAnnotation.java
deleted file mode 100644
index c0bd44b990..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinColumnAnnotation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java
deleted file mode 100644
index 645c79ccbc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullJoinTableAnnotation.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import java.util.ListIterator;
-
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java
deleted file mode 100644
index 18c1d0ea9d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullNamedColumnAnnotation.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index 001603ed06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java
deleted file mode 100644
index 2d20449e4b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTableAnnotation.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java
deleted file mode 100644
index 53cc82e132..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/NullTemporalAnnotation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyAnnotationDefinition.java
deleted file mode 100644
index badac71ca2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToManyAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOneToManyAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToManyAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneAnnotationDefinition.java
deleted file mode 100644
index 65c47d13d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OneToOneAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOneToOneAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToOneAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByAnnotationDefinition.java
deleted file mode 100644
index 5a74ee9fa9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/OrderByAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryOrderByAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceOrderByAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
deleted file mode 100644
index 6c1a617efc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
deleted file mode 100644
index 7517cd43a9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
deleted file mode 100644
index 5613593c17..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinarySecondaryTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
deleted file mode 100644
index dabfb2bce7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinarySecondaryTablesAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceSecondaryTablesAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
deleted file mode 100644
index 0532b556d0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.binary.BinarySequenceGenerator1_0Annotation;
-import org.eclipse.jpt.core.internal.jpa1.resource.java.source.SourceSequenceGenerator1_0Annotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/TableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableAnnotationDefinition.java
deleted file mode 100644
index 9029ba06c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryTableAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTableAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
deleted file mode 100644
index eefae9448b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Member;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryTableGeneratorAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalAnnotationDefinition.java
deleted file mode 100644
index 6a039b7136..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TemporalAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryTemporalAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTemporalAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/TransientAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientAnnotationDefinition.java
deleted file mode 100644
index bdaad7b424..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/TransientAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryTransientAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceTransientAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/VersionAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionAnnotationDefinition.java
deleted file mode 100644
index 8518576d5f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/VersionAnnotationDefinition.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.Attribute;
-import org.eclipse.jpt.core.internal.resource.java.binary.BinaryVersionAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.source.SourceVersionAnnotation;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotatedElement.java
deleted file mode 100644
index e2b775110b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotatedElement.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyListIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-
-/**
- * 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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java
deleted file mode 100644
index 86e581f644..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAnnotation.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
deleted file mode 100644
index 439b0442b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java
deleted file mode 100644
index f4894e174d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
deleted file mode 100644
index ba8aba5227..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java
deleted file mode 100644
index 1cecad35c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
deleted file mode 100644
index a0d263f06e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
deleted file mode 100644
index 4c4c619f3c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.EnumType;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
deleted file mode 100644
index cbbfaff723..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.BaseJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
deleted file mode 100644
index e59382c3e8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
deleted file mode 100644
index 8ad2917c45..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java
deleted file mode 100644
index 6feeabb30d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryBasicAnnotation.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java
deleted file mode 100644
index 037eda1ea4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryClassFile.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.core.resource.java.JavaResourceClassFile;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java
deleted file mode 100644
index 274a2fe0bc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryColumnAnnotation.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
deleted file mode 100644
index d922693f4e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java
deleted file mode 100644
index 3f284b73d4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryContainerAnnotation.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.Annotation;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
deleted file mode 100644
index ea3b6ce596..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
deleted file mode 100644
index e5a012d591..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
deleted file mode 100644
index 91db09f2a2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
deleted file mode 100644
index 2fd143485d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
deleted file mode 100644
index 604f5be572..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java
deleted file mode 100644
index f75a784870..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEntityAnnotation.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
deleted file mode 100644
index 08ffef0291..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
deleted file mode 100644
index 9197dda6f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.GenerationType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
deleted file mode 100644
index 83bf6497fb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java
deleted file mode 100644
index 95946b447e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
deleted file mode 100644
index bb3b392a11..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
deleted file mode 100644
index e51c45ba76..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
deleted file mode 100644
index f78bbe483e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java
deleted file mode 100644
index 28a12e517d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
deleted file mode 100644
index 12957724d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java
deleted file mode 100644
index 0936195b51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryLobAnnotation.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
deleted file mode 100644
index 2508759c2c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.ManyToMany2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
deleted file mode 100644
index bfc30b7bf9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.ManyToOne2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
deleted file mode 100644
index 3430106e66..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
deleted file mode 100644
index 419bfaaa06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
deleted file mode 100644
index 1b4e0ce720..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java
deleted file mode 100644
index 8f8a12d239..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
deleted file mode 100644
index f1fb402d89..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java
deleted file mode 100644
index 810cbe93fe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
deleted file mode 100644
index d04eaa000e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java
deleted file mode 100644
index 0979bb31d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryNode.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
deleted file mode 100644
index 213acacc55..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToMany2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
deleted file mode 100644
index e4961ffffa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToOne2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
deleted file mode 100644
index 38329f78a1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
deleted file mode 100644
index 394d26045c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java
deleted file mode 100644
index 734439b56d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragment.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.JavaResourceClassFile;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * 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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java
deleted file mode 100644
index ea9fdc5268..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragment;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java
deleted file mode 100644
index 6b579e93c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentAttribute.java
+++ /dev/null
@@ -1,657 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.ClassName;
-import org.eclipse.jpt.utility.internal.NameTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
-
- private String[] getSuperInterfaceTypeSignatures(IType type) {
- try {
- return type.getSuperInterfaceTypeSignatures();
- } catch (JavaModelException ex) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.log(ex);
- return 0;
- }
- }
-
- public String getReturnTypeErasureName() {
- return convertTypeSignatureToTypeName(this.getReturnTypeSignature());
- }
-
- private String getReturnTypeSignature() {
- try {
- return this.getMethod().getReturnType();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return null;
- }
- }
-
- public boolean isConstructor() {
- try {
- return this.getMethod().isConstructor();
- } catch (JavaModelException ex) {
- JptCorePlugin.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) {
- JptCorePlugin.log(ex);
- return EMPTY_METHOD_ARRAY;
- }
- }
-
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java
deleted file mode 100644
index a604e8fac8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentMember.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * 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) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java
deleted file mode 100644
index 20e811f4dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentType.java
+++ /dev/null
@@ -1,694 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * 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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.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) {
- JptCorePlugin.log(ex);
- return 0;
- }
- }
-
- public boolean isAnnotation() {
- try {
- return this.type.isAnnotation();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isAnonymous() {
- try {
- return this.type.isAnonymous();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isArray() {
- return false; // ???
- }
-
- public boolean isEnum() {
- try {
- return this.type.isEnum();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isInterface() {
- try {
- return this.type.isInterface();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isLocal() {
- try {
- return this.type.isLocal();
- } catch (JavaModelException ex) {
- JptCorePlugin.log(ex);
- return false;
- }
- }
-
- public boolean isMember() {
- try {
- return this.type.isMember();
- } catch (JavaModelException ex) {
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java
deleted file mode 100644
index bc1b8a1225..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPersistentTypeCache.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentTypeCache;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.utility.internal.StringTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index 56bd7ae0b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java
deleted file mode 100644
index 53fb9f0d46..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryAnnotation.java
deleted file mode 100644
index 86d34f1852..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryAnnotation.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.QueryAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
deleted file mode 100644
index b81056dfaf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
deleted file mode 100644
index 1d1f4659a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
-import org.eclipse.jpt.core.resource.java.CascadeType;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
deleted file mode 100644
index 7e018e6cb9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.ListIterator;
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java
deleted file mode 100644
index 5dbc1fd97f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import java.util.Vector;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
deleted file mode 100644
index 8bc1628575..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java
deleted file mode 100644
index e7bcdc7306..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableAnnotation.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
deleted file mode 100644
index 6798e70061..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
deleted file mode 100644
index b4e6fd81ee..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java
deleted file mode 100644
index 92e643fd4b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryTransientAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
deleted file mode 100644
index 2d8af3aec7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java
deleted file mode 100644
index 37f3256a19..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/BinaryVersionAnnotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java
deleted file mode 100644
index 0c5cf221d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/binary/RootBinaryNode.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.utility.internal.ListenerList;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/AnnotationContainerTools.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/AnnotationContainerTools.java
deleted file mode 100644
index 17137270f9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/AnnotationContainerTools.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotatedElement.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotatedElement.java
deleted file mode 100644
index 9d67139b09..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotatedElement.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*******************************************************************************
- * 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.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.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-import org.eclipse.jpt.utility.internal.iterators.SingleElementIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotation.java
deleted file mode 100644
index 889c587283..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAnnotation.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.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.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.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
deleted file mode 100644
index e6419f35a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java
deleted file mode 100644
index 0d49a5d3fd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AssociationOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAssociationOverrideAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
deleted file mode 100644
index 6b29377bf0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
deleted file mode 100644
index 134b5b2081..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.core.resource.java.AttributeOverridesAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAttributeOverrideAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
deleted file mode 100644
index 2bd65e65c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.BaseColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
deleted file mode 100644
index 3cfb0d92a4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.EnumType;
-import org.eclipse.jpt.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
deleted file mode 100644
index dcc109d7e2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.BaseJoinColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTableAnnotation.java
deleted file mode 100644
index e5299809e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTableAnnotation.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableUniqueConstraintAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
deleted file mode 100644
index 36a376da31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBasicAnnotation.java
deleted file mode 100644
index e6fdecc2d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceBasicAnnotation.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceColumnAnnotation.java
deleted file mode 100644
index 3a38ff33fc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceColumnAnnotation.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.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.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompilationUnit.java
deleted file mode 100644
index 4bcc158016..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompilationUnit.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.internal.ListenerList;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
deleted file mode 100644
index ba5ced4f0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
deleted file mode 100644
index f1daf7146e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.DiscriminatorType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
deleted file mode 100644
index 8010a1745e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
deleted file mode 100644
index fe06e71681..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
deleted file mode 100644
index 1f6834adcb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
deleted file mode 100644
index 8bb62ad982..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEntityAnnotation.java
deleted file mode 100644
index 428e58c41e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEntityAnnotation.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
deleted file mode 100644
index 4ca4520a8f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
deleted file mode 100644
index 6cbf589723..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.core.resource.java.GenerationType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratorAnnotation.java
deleted file mode 100644
index d165f9d3be..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceGeneratorAnnotation.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdAnnotation.java
deleted file mode 100644
index b78e08bfbe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java
deleted file mode 100644
index 763f6031dd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceIdClassAnnotation.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceInheritanceAnnotation.java
deleted file mode 100644
index 00dba34c9f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceInheritanceAnnotation.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.core.resource.java.InheritanceType;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
deleted file mode 100644
index 9128f7da81..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java
deleted file mode 100644
index b922396a01..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinColumnsAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinTableAnnotation.java
deleted file mode 100644
index fd0a8bc5c2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceJoinTableAnnotation.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableJoinColumnAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceLobAnnotation.java
deleted file mode 100644
index 0b4e60861b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceLobAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToManyAnnotation.java
deleted file mode 100644
index 1feed99374..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToManyAnnotation.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.ManyToMany2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToOneAnnotation.java
deleted file mode 100644
index 2072ec415b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceManyToOneAnnotation.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.ManyToOne2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMapKeyAnnotation.java
deleted file mode 100644
index 36c2827df1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMapKeyAnnotation.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
deleted file mode 100644
index 221245c794..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
deleted file mode 100644
index f8bc48ad57..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java
deleted file mode 100644
index 93e3bfa913..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
deleted file mode 100644
index f6d628c3f9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableNamedNativeQueryAnnotation;
-import org.eclipse.jpt.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.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java
deleted file mode 100644
index e9073a1344..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.utility.jdt.Type;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java
deleted file mode 100644
index 1155849099..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NamedQueriesAnnotation;
-import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
deleted file mode 100644
index d46a99aa45..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableNamedQueryAnnotation;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNode.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNode.java
deleted file mode 100644
index c7efc200ae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceNode.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.core.internal.resource.java.AbstractJavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToManyAnnotation.java
deleted file mode 100644
index d47f3f62ea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToManyAnnotation.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToMany2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToOneAnnotation.java
deleted file mode 100644
index b47683b28f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOneToOneAnnotation.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.OneToOne2_0Annotation;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOrderByAnnotation.java
deleted file mode 100644
index d79ed34949..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOrderByAnnotation.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOverrideAnnotation.java
deleted file mode 100644
index 4759729294..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceOverrideAnnotation.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePackage.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePackage.java
deleted file mode 100644
index 36e9bc00ab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePackage.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * 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.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.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
deleted file mode 100644
index c8326b1ff6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.core.resource.java.JavaResourcePackageInfoCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * @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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java
deleted file mode 100644
index 9b69df700d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentAttribute.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.ClassName;
-import org.eclipse.jpt.utility.internal.iterators.CloneIterator;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java
deleted file mode 100644
index 85414114c9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentMember.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
-import org.eclipse.jpt.utility.Filter;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
deleted file mode 100644
index b6a6c21c62..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePersistentType.java
+++ /dev/null
@@ -1,930 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.internal.jpa2.resource.java.GeneratedAnnotationDefinition;
-import org.eclipse.jpt.core.internal.jpa2.resource.java.StaticMetamodelAnnotationDefinition;
-import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.core.jpa2.resource.java.JavaResourcePersistentType2_0;
-import org.eclipse.jpt.core.jpa2.resource.java.StaticMetamodelAnnotation;
-import org.eclipse.jpt.core.resource.java.AccessType;
-import org.eclipse.jpt.core.resource.java.Annotation;
-import org.eclipse.jpt.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.MethodSignature;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.SimpleIntReference;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.utility.internal.iterators.TreeIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index 16e605caf2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java
deleted file mode 100644
index d1ae88f91d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryAnnotation.java
deleted file mode 100644
index 2fbd1eca7e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryAnnotation.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableQueryHintAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryAnnotation;
-import org.eclipse.jpt.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryHintAnnotation.java
deleted file mode 100644
index 1a03fb97d4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceQueryHintAnnotation.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
deleted file mode 100644
index 544c496b12..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
-import org.eclipse.jpt.core.resource.java.CascadeType;
-import org.eclipse.jpt.core.resource.java.FetchType;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.utility.internal.ArrayTools;
-
-/**
- * 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.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
deleted file mode 100644
index d62e2a02c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestablePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java
deleted file mode 100644
index f59599cb8c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.core.resource.java.NestableSecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.core.resource.java.SecondaryTablesAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
deleted file mode 100644
index 7e0d01d7d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableAnnotation.java
deleted file mode 100644
index af7d708950..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableAnnotation.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
deleted file mode 100644
index a758ab8f30..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.AnnotationContainer;
-import org.eclipse.jpt.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableUniqueConstraintAnnotation;
-import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.StringTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTemporalAnnotation.java
deleted file mode 100644
index c88085557d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTemporalAnnotation.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * 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.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.core.resource.java.JPA;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTransientAnnotation.java
deleted file mode 100644
index 6101ba9269..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTransientAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTypeCompilationUnit.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTypeCompilationUnit.java
deleted file mode 100644
index 5e201cff82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceTypeCompilationUnit.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.JpaAnnotationProvider;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.utility.CommandExecutor;
-import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
-
-/**
- * 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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
deleted file mode 100644
index ed14889f70..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JPA;
-import org.eclipse.jpt.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.core.resource.java.NestableUniqueConstraintAnnotation;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
-
-/**
- * <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.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceVersionAnnotation.java
deleted file mode 100644
index f00e004d9f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/java/source/SourceVersionAnnotation.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.java.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.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java
deleted file mode 100644
index 068c58b3f1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/orm/OrmXmlResourceProvider.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.core.resource.orm.AccessType;
-import org.eclipse.jpt.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.core.resource.orm.XmlPersistenceUnitDefaults;
-import org.eclipse.jpt.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, JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
- }
-
- private static OrmXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
- return new OrmXmlResourceProvider(project, fullPath);
- }
-
-
- public OrmXmlResourceProvider(IProject project) {
- this(project, JptCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
- }
-
- public OrmXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
deleted file mode 100644
index 42d6d7b3d5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-import org.eclipse.jpt.core.internal.operations.PersistenceFileCreationDataModelProperties;
-import org.eclipse.jpt.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.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, JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
- }
-
- private static PersistenceXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
- return new PersistenceXmlResourceProvider(project, fullPath);
- }
-
-
- public PersistenceXmlResourceProvider(IProject project) {
- this(project, JptCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
- }
-
- public PersistenceXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java
deleted file mode 100644
index 9f8311048e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Oracle.
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Oracle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jpt.core.internal.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.core.JpaFile;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.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 = JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourcePropertyTester.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourcePropertyTester.java
deleted file mode 100644
index f1c518dffa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/resource/xml/JpaXmlResourcePropertyTester.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.resource.xml;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.XmlFile;
-import org.eclipse.jpt.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 = JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java
deleted file mode 100644
index 6fbff6eec8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/synch/SynchronizeClassesJob.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.core.context.persistence.Persistence;
-import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.core.internal.JptCoreMessages;
-import org.eclipse.jpt.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
-
-/**
- * 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 = JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/validation/DefaultJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/DefaultJpaValidationMessages.java
deleted file mode 100644
index 414afffdb6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/DefaultJpaValidationMessages.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * 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.core.internal.validation;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.core.JptCorePlugin;
-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(JptCorePlugin.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
- JptCorePlugin.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.core/src/org/eclipse/jpt/core/internal/validation/JpaHelper.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaHelper.java
deleted file mode 100644
index 7789238c30..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaHelper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.core.internal.validation;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.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.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationDescriptionMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationDescriptionMessages.java
deleted file mode 100644
index df807f50ca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationDescriptionMessages.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
deleted file mode 100644
index 6de7c7201f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * 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.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.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationPreferences.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationPreferences.java
deleted file mode 100644
index d90ea7b801..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationPreferences.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * 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.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.core.JptCorePlugin;
-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 JptCorePlugin
-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(JptCorePlugin.getProjectPreferences(project), messageId);
- }
-
- public static void setProjectLevelProblemPreference(IProject project, String messageId, String problemPreference) {
- IEclipsePreferences projectPreferences = JptCorePlugin.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(JptCorePlugin.getWorkspacePreferences(), messageId);
- }
-
- public static void setWorkspaceLevelProblemPreference(String messageId, String problemPreference) {
- IEclipsePreferences workspacePreferences = JptCorePlugin.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) {
- JptCorePlugin.log(ex);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
deleted file mode 100644
index 4805520b0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidator.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.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.core.JpaProject;
-import org.eclipse.jpt.core.JptCorePlugin;
-import org.eclipse.jpt.utility.internal.CollectionTools;
-import org.eclipse.jpt.utility.internal.iterables.SingleElementIterable;
-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) {
- JptCorePlugin.log(ce);
- }
- }
-
- private void clearMarkers_(IProject project) throws CoreException {
- IMarker[] markers = project.findMarkers(JptCorePlugin.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 = JptCorePlugin.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;
- }
-}

Back to the top