Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java414
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java577
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java149
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java1928
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java198
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java159
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaAnnotationProvider.java174
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java18
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java445
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java24
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java175
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractAccessor.java268
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java322
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java363
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java322
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java382
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java1703
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java248
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java479
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java307
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java195
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java784
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java295
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumnTextRangeResolver.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java86
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java247
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java819
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java1115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java260
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java361
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java155
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java552
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java287
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java265
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java212
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java365
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/DefaultJavaAttributeMappingDefinitionWrapper.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/FieldAccessor.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java277
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java199
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java195
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java275
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java223
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java274
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java303
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java232
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java351
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java377
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaAttributeMappingDefinitionWrapper.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingDefinitionWrapper.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PropertyAccessor.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java926
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java414
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java302
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java301
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java424
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java2207
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java245
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java499
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java291
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java801
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java289
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumnTextRangeResolver.java30
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java284
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java396
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java500
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java476
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java342
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java263
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java364
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java392
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java380
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java174
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java179
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java225
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java244
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java267
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java189
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java309
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java396
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java389
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java295
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java67
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java543
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java381
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java388
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java361
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java2774
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java529
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java735
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java114
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java228
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java613
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java191
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java266
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java267
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java176
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java34
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java316
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java20
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentFieldValidator.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java136
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java593
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java241
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java260
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java221
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java182
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java303
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java233
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java260
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java211
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java465
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java485
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java320
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java206
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java265
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java276
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java363
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java540
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java388
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java256
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java172
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java120
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java474
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmPersistenceUnitDefaults.java348
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmPersistenceUnitMetadata.java190
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java155
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java306
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java160
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java311
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java192
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java218
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java467
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java43
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java450
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java308
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java1382
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java176
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java253
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java262
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java375
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java414
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java167
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java135
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java256
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java304
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java171
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java383
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java301
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java25
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java160
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java251
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java171
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java78
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java162
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java434
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java54
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java1560
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java170
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java177
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java370
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java250
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java126
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java97
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java129
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java153
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaBasicMappingDefinition2_0.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java107
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddableDefinition2_0.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedIdMappingDefinition2_0.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEntityDefinition2_0.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java100
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaMappedSuperclassDefinition2_0.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaVersionMappingDefinition2_0.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java66
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java93
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java275
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java1526
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java205
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java173
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java282
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java200
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java118
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java128
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java65
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java333
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java62
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java51
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java58
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java77
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java70
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java139
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java161
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java188
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java220
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyJoinColumn2_0Annotation.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java42
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java123
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java213
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java127
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java133
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/ClassConstructor.java143
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java99
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java246
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java271
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java245
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java134
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java275
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java269
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java57
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnitEntity.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java115
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java430
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java404
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java138
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java27
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java64
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java157
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java278
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java17
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java31
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java109
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java238
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java288
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java294
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java257
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java210
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java254
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java239
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java242
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java113
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java194
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java189
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java165
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java41
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java61
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java52
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java47
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java84
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java63
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java59
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java96
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java184
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseDiscriminatorColumnAnnotation.java83
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java73
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java196
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java69
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java98
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java91
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java124
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java76
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java130
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java72
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java154
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java88
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java80
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java112
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java119
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java121
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java71
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java79
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java151
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java102
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java233
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java110
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java92
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java55
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java288
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java37
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java101
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java157
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java204
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java293
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseDiscriminatorColumnAnnotation.java152
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java94
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java117
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java296
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java95
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java145
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java106
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java192
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java60
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java104
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java111
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java38
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java148
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java193
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java160
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java105
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java147
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java221
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java141
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java142
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java169
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java240
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java81
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java227
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java103
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java108
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java180
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java227
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java176
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java358
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java185
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java132
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java392
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java39
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java46
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java156
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java45
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java82
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java75
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java48
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java53
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java146
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java68
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaHelper.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationDescriptionMessages.java36
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java259
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java140
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java121
738 files changed, 0 insertions, 110979 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java
deleted file mode 100644
index 12efe74491..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java
+++ /dev/null
@@ -1,66 +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.jpa.core.internal;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
-
-public abstract class AbstractJpaAnnotationDefinitionProvider
- implements JpaAnnotationDefinitionProvider
-{
- protected ArrayList<AnnotationDefinition> annotationDefinitions;
-
- protected ArrayList<NestableAnnotationDefinition> nestableAnnotationDefinitions;
-
-
- protected AbstractJpaAnnotationDefinitionProvider() {
- super();
- }
-
-
- // ********** annotation definitions **********
-
- public synchronized Iterable<AnnotationDefinition> getAnnotationDefinitions() {
- if (this.annotationDefinitions == null) {
- this.annotationDefinitions = this.buildAnnotationDefinitions();
- }
- return this.annotationDefinitions;
- }
-
- protected ArrayList<AnnotationDefinition> buildAnnotationDefinitions() {
- ArrayList<AnnotationDefinition> definitions = new ArrayList<AnnotationDefinition>();
- this.addAnnotationDefinitionsTo(definitions);
- return definitions;
- }
-
- protected abstract void addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions);
-
-
- // ********** nestable annotation definitions **********
-
- public synchronized Iterable<NestableAnnotationDefinition> getNestableAnnotationDefinitions() {
- if (this.nestableAnnotationDefinitions == null) {
- this.nestableAnnotationDefinitions = this.buildNestableAnnotationDefinitions();
- }
- return this.nestableAnnotationDefinitions;
- }
-
- protected ArrayList<NestableAnnotationDefinition> buildNestableAnnotationDefinitions() {
- ArrayList<NestableAnnotationDefinition> definitions = new ArrayList<NestableAnnotationDefinition>();
- this.addNestableAnnotationDefinitionsTo(definitions);
- return definitions;
- }
-
- protected abstract void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions);
-
-}
-
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
deleted file mode 100644
index bdc509a362..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java
+++ /dev/null
@@ -1,414 +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.jpa.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptResourceModel;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jpa.core.JpaDataSource;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.java.Accessor;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.jpa.core.context.java.JavaTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaVirtualJoinTable;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaNullTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaDataSource;
-import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFile;
-import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaProject;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaBasicMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEntity;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEnumeratedConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaGeneratedValue;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaGeneratorContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaIdMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaJoinTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaLobConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaManyToManyMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaManyToOneMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappedSuperclass;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNamedQuery;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOneToManyMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOneToOneMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOrderable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOverrideRelationship;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaQueryContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaQueryHint;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaSecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaSequenceGenerator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTableGenerator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTemporalConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTransientMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVersionMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualOverrideRelationship;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-
-/**
- * Central class that allows extenders to easily replace implementations of
- * various Dali interfaces.
- */
-public abstract class AbstractJpaFactory
- implements JpaFactory
-{
- protected AbstractJpaFactory() {
- super();
- }
-
-
- // ********** Core Model **********
-
- public JpaProject buildJpaProject(JpaProject.Config config) {
- return new GenericJpaProject(config);
- }
-
- public JpaDataSource buildJpaDataSource(JpaProject jpaProject, String connectionProfileName) {
- return new GenericJpaDataSource(jpaProject, connectionProfileName);
- }
-
- public JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JptResourceModel resourceModel) {
- return new GenericJpaFile(jpaProject, file, contentType, resourceModel);
- }
-
-
- // ********** Context Nodes **********
-
- public JpaRootContextNode buildRootContextNode(JpaProject parent) {
- return new GenericRootContextNode(parent);
- }
-
-
- // ********** XML Context Model **********
-
- public PersistenceXml buildPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource) {
- return new GenericPersistenceXml(parent, resource);
- }
-
- public OrmXml buildMappingFile(MappingFileRef parent, JpaXmlResource resource) {
- return new GenericOrmXml(parent, resource);
- }
-
-
- // ********** Java Context Model **********
-
- public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourceType jrt) {
- return new GenericJavaPersistentType(owner, jrt);
- }
-
- public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, Accessor accessor) {
- return new GenericJavaPersistentAttribute(parent, accessor);
- }
-
- public JavaPersistentAttribute buildJavaPersistentField(PersistentType parent, JavaResourceField resourceField) {
- return new GenericJavaPersistentAttribute(parent, resourceField);
- }
-
- public JavaPersistentAttribute buildJavaPersistentProperty(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
- return new GenericJavaPersistentAttribute(parent, resourceGetter, resourceSetter);
- }
-
- 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, JavaReadOnlyJoinColumn.Owner owner, JoinColumnAnnotation joinColumnAnnotation) {
- return new GenericJavaJoinColumn(parent, owner, joinColumnAnnotation);
- }
-
- public JavaVirtualJoinColumn buildJavaVirtualJoinColumn(JavaJpaContextNode parent, JavaReadOnlyJoinColumn.Owner owner, ReadOnlyJoinColumn overriddenColumn) {
- return new GenericJavaVirtualJoinColumn(parent, owner, overriddenColumn);
- }
-
- public JavaJoinTable buildJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Table.Owner owner) {
- return new GenericJavaJoinTable(parent, owner);
- }
-
- public JavaVirtualJoinTable buildJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, ReadOnlyTable.Owner owner, ReadOnlyJoinTable overriddenTable) {
- return new GenericJavaVirtualJoinTable(parent, owner, 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, JavaReadOnlyBaseJoinColumn.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, ReadOnlyUniqueConstraint overriddenUniqueConstraint) {
- return new GenericJavaVirtualUniqueConstraint(parent, overriddenUniqueConstraint);
- }
-
- public JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation) {
- return new GenericJavaEnumeratedConverter(parent, annotation);
- }
-
- public JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation) {
- return new GenericJavaTemporalConverter(parent, annotation);
- }
-
- public JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation) {
- return new GenericJavaLobConverter(parent, annotation);
- }
-
- public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) {
- return new GenericJavaOrderable(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
deleted file mode 100644
index 5106876b4c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
+++ /dev/null
@@ -1,577 +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.jpa.core.internal;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.Vector;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JDTModifiedDeclaration.Adapter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport;
-import org.eclipse.jpt.common.utility.internal.model.ChangeSupport;
-import org.eclipse.jpt.jpa.core.JpaDataSource;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaNode;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Database;
-
-/**
- * Some common Dali behavior:<ul>
- * <li>containment hierarchy
- * <li>Eclipse adaptable
- * <li>update triggers
- * </ul>
- */
-public abstract class AbstractJpaNode
- extends AbstractModel
- implements JpaNode
-{
- protected final JpaNode parent;
-
-
- // ********** constructor/initialization **********
-
- protected AbstractJpaNode(JpaNode parent) {
- super();
- this.checkParent(parent);
- this.parent = parent;
- }
-
- protected void checkParent(JpaNode p) {
- if (p == null) {
- if (this.requiresParent()) {
- throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$
- }
- } else {
- if (this.forbidsParent()) {
- throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$
- }
- }
- }
-
- protected boolean requiresParent() {
- return true;
- }
-
- protected final boolean forbidsParent() {
- return ! this.requiresParent(); // assume 'parent' is not optional
- }
-
- @Override
- protected ChangeSupport buildChangeSupport() {
- return new AspectChangeSupport(this, this.buildChangeSupportListener());
- }
-
- protected AspectChangeSupport.Listener buildChangeSupportListener() {
- return new AspectChangeSupport.Listener() {
- public void aspectChanged(String aspectName) {
- AbstractJpaNode.this.aspectChanged(aspectName);
- }
- };
- }
-
-
- // ********** IAdaptable implementation **********
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
-
- // ********** JpaNode implementation **********
-
- public JpaNode getParent() {
- return this.parent;
- }
-
- public IResource getResource() {
- return this.parent.getResource();
- }
-
- public JpaProject getJpaProject() {
- return this.parent.getJpaProject();
- }
-
-
- // ********** convenience methods **********
-
- protected JpaPlatform getJpaPlatform() {
- return this.getJpaProject().getJpaPlatform();
- }
-
- protected JpaPlatform.Version getJpaPlatformVersion() {
- return this.getJpaPlatform().getJpaVersion();
- }
-
- protected boolean isJpa2_0Compatible() {
- return JptJpaCorePlugin.nodeIsJpa2_0Compatible(this);
- }
-
- /**
- * Call {@link #isJpa2_0Compatible()} before calling this method.
- */
- protected JpaFactory2_0 getJpaFactory2_0() {
- return (JpaFactory2_0) this.getJpaFactory();
- }
-
- protected JpaFactory getJpaFactory() {
- return this.getJpaPlatform().getJpaFactory();
- }
-
- protected JpaPlatformVariation getJpaPlatformVariation() {
- return this.getJpaPlatform().getJpaVariation();
- }
-
- protected JpaFile getJpaFile(IFile file) {
- return this.getJpaProject().getJpaFile(file);
- }
-
- protected JpaDataSource getDataSource() {
- return this.getJpaProject().getDataSource();
- }
-
- protected Database getDatabase() {
- return this.getDataSource().getDatabase();
- }
-
- protected boolean connectionProfileIsActive() {
- return this.getDataSource().connectionProfileIsActive();
- }
-
- /**
- * Pre-condition: specified catalog <em>identifier</em> is not
- * <code>null</code>.
- * <p>
- * <strong>NB:</strong> 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.
- */
- protected static final String[] EMPTY_STRING_ARRAY = StringTools.EMPTY_STRING_ARRAY;
-
-
- /**
- * Adapter used to synchronize a context collection container with its corresponding
- * resource container.
- * @param <C> the type of context elements
- * @param <R> the type of resource elements
- */
- protected abstract class CollectionContainer<C, R> {
-
- protected final Vector<C> contextElements = new Vector<C>();
-
- protected CollectionContainer() {
- super();
- this.initializeContextElements();
- }
-
- /**
- * Return the container's current set of resource elements.
- * These are what the context elements will be synchronized to.
- */
- protected abstract Iterable<R> getResourceElements();
-
- /**
- * Return the resource element corresponding to the specified context
- * element.
- */
- protected abstract R getResourceElement(C contextElement);
-
- /**
- * Build and return a context element for the given resource element
- */
- protected abstract C buildContextElement(R resourceElement);
-
- /**
- * Return the property name for event notification when the collection is changed.
- */
- protected abstract String getContextElementsPropertyName();
-
- protected void initializeContextElements() {
- for (R resourceElement : this.getResourceElements()) {
- this.contextElements.add(this.buildContextElement(resourceElement));
- }
- }
-
- /**
- * Return an Iterable of the context elements
- */
- public Iterable<C> getContextElements() {
- return new LiveCloneIterable<C>(this.contextElements);
- }
-
- /**
- * Return the size of the context elements collection
- */
- public int getContextElementsSize() {
- return this.contextElements.size();
- }
-
- /**
- * Add a context element for the specified resource element at the
- * specified index.
- */
- public C addContextElement(int index, R resourceElement) {
- return this.addContextElement_(index, this.buildContextElement(resourceElement));
- }
-
- /**
- * Add the specified context element to the collection ignoring
- * the specified index as we only have a collection
- */
- protected C addContextElement_(@SuppressWarnings("unused") int index, C contextElement) {
- AbstractJpaNode.this.addItemToCollection(contextElement, this.contextElements, this.getContextElementsPropertyName());
- return contextElement;
- }
-
- /**
- * Remove the specified context element from the container.
- */
- public void removeContextElement(C element) {
- AbstractJpaNode.this.removeItemFromCollection(element, this.contextElements, this.getContextElementsPropertyName());
- }
-
- @SuppressWarnings("unused")
- protected void moveContextElement(int index, C element) {
- //no-op, not a list
- }
- }
-
- /**
- * Adapter used to synchronize a context collection container with its corresponding
- * resource container.
- * @param <C> the type of context elements
- * @param <R> the type of resource elements
- */
- protected abstract class ContextCollectionContainer<C extends JpaContextNode, R> extends CollectionContainer<C, R> {
-
- protected ContextCollectionContainer() {
- super();
- }
-
- /**
- * 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 void synchronizeWithResourceModel() {
- sync(true); // true = sync
- }
-
- /**
- * @see #synchronizeWithResourceModel(Adapter)
- */
- public void update() {
- sync(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 void sync(boolean sync) {
- HashSet<C> contextElements = CollectionTools.set(this.getContextElements());
- ArrayList<C> contextElementsToSync = new ArrayList<C>(contextElements.size());
- int resourceIndex = 0;
-
- for (R resourceElement : this.getResourceElements()) {
- boolean match = false;
- for (Iterator<C> stream = contextElements.iterator(); stream.hasNext(); ) {
- C contextElement = stream.next();
- if (Tools.valuesAreEqual(this.getResourceElement(contextElement), resourceElement)) {
- // we don't know the source index because the element has been moved by previously moved elements
- this.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)
- this.addContextElement(resourceIndex, resourceElement);
- }
- resourceIndex++;
- }
- // remove any leftover context elements
- for (C contextElement : contextElements) {
- 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();
- }
- }
- }
- }
-
- /**
- * Adapter used to synchronize a context list container with its corresponding
- * resource container.
- * @param <C> the type of context elements
- * @param <R> the type of resource elements
- */
- protected abstract class ListContainer<C, R>
- extends CollectionContainer<C, R> {
-
- protected ListContainer() {
- super();
- }
-
- @Override
- public ListIterable<C> getContextElements() {
- return new LiveCloneListIterable<C>(this.contextElements);
- }
-
- @Override
- protected abstract ListIterable<R> getResourceElements();
-
- /**
- * Return the index of the specified context element.
- */
- public int indexOfContextElement(C contextElement) {
- return this.contextElements.indexOf(contextElement);
- }
-
- public C getContextElement(int index) {
- return this.contextElements.elementAt(index);
- }
-
- /**
- * Add a context element for the specified resource element at the
- * specified index.
- */
- @Override
- protected C addContextElement_(int index, C contextElement) {
- AbstractJpaNode.this.addItemToList(index, contextElement, this.contextElements, this.getContextElementsPropertyName());
- return contextElement;
- }
-
- /**
- * Move the context element at the specified target index to the
- * specified source index.
- */
- public void moveContextElement(int targetIndex, int sourceIndex) {
- this.moveContextElement(targetIndex, this.contextElements.get(sourceIndex));
- }
-
- /**
- * Move the specified context element to the specified index.
- */
- @Override
- public void moveContextElement(int index, C element) {
- AbstractJpaNode.this.moveItemInList(index, element, this.contextElements, this.getContextElementsPropertyName());
- }
-
- /**
- * Remove the context element at the specified index from the container.
- */
- public void removeContextElement(int index) {
- AbstractJpaNode.this.removeItemFromList(index, this.contextElements, this.getContextElementsPropertyName());
- }
-
- public void synchronizeWithResourceModel() {
- ListIterable<R> resourceElements = getResourceElements();
-
- int index = 0;
- for (R resourceElement : resourceElements) {
- if (this.getContextElementsSize() > index) {
- if (this.getContextElement(index) != resourceElement) {
- this.addContextElement(index, resourceElement);
- }
- }
- else {
- this.addContextElement(index, resourceElement);
- }
- index++;
- }
-
- for ( ; index < this.getContextElementsSize(); ) {
- this.removeContextElement(index);
- }
- }
- }
-
- /**
- * Adapter used to synchronize a context list container with its corresponding
- * resource container.
- * @param <C> the type of context elements
- * @param <R> the type of resource elements
- */
- protected abstract class ContextListContainer<C extends JpaContextNode, R>
- extends ContextCollectionContainer<C, R> {
-
- protected ContextListContainer() {
- super();
- }
-
- @Override
- public ListIterable<C> getContextElements() {
- return new LiveCloneListIterable<C>(this.contextElements);
- }
-
- @Override
- protected abstract ListIterable<R> getResourceElements();
-
- /**
- * Return the index of the specified context element.
- */
- public int indexOfContextElement(C contextElement) {
- return this.contextElements.indexOf(contextElement);
- }
-
- public C getContextElement(int index) {
- return this.contextElements.elementAt(index);
- }
-
- /**
- * Add a context element for the specified resource element at the
- * specified index.
- */
- @Override
- protected C addContextElement_(int index, C contextElement) {
- AbstractJpaNode.this.addItemToList(index, contextElement, this.contextElements, this.getContextElementsPropertyName());
- return contextElement;
- }
-
- /**
- * Move the context element at the specified target index to the
- * specified source index.
- */
- public void moveContextElement(int targetIndex, int sourceIndex) {
- this.moveContextElement(targetIndex, this.contextElements.get(sourceIndex));
- }
-
- /**
- * clear the list of context elements
- */
- public void clearContextList() {
- AbstractJpaNode.this.clearList(this.contextElements, getContextElementsPropertyName());
- }
-
- /**
- * Move the specified context element to the specified index.
- */
- @Override
- public void moveContextElement(int index, C element) {
- AbstractJpaNode.this.moveItemInList(index, element, this.contextElements, this.getContextElementsPropertyName());
- }
-
- /**
- * Remove the context element at the specified index from the container.
- */
- public C removeContextElement(int index) {
- return AbstractJpaNode.this.removeItemFromList(index, this.contextElements, this.getContextElementsPropertyName());
- }
-
- @Override
- public void removeContextElement(C contextElement) {
- this.removeContextElement(this.indexOfContextElement(contextElement));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java
deleted file mode 100644
index 785068d04f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.ResourceDefinition;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public abstract class AbstractJpaPlatformProvider
- implements JpaPlatformProvider
-{
- protected ArrayList<JpaResourceModelProvider> resourceModelProviders;
-
- protected ArrayList<JavaTypeMappingDefinition> javaTypeMappingDefinitions;
-
- protected ArrayList<DefaultJavaAttributeMappingDefinition> defaultJavaAttributeMappingDefinitions;
-
- protected ArrayList<JavaAttributeMappingDefinition> specifiedJavaAttributeMappingDefinitions;
-
- protected ArrayList<ResourceDefinition> resourceDefinitions;
-
-
- /**
- * zero-argument constructor
- */
- protected AbstractJpaPlatformProvider() {
- super();
- }
-
-
- // ********** resource models **********
-
- public synchronized Iterable<JpaResourceModelProvider> getResourceModelProviders() {
- if (this.resourceModelProviders == null) {
- this.resourceModelProviders = this.buildResourceModelProviders();
- }
- return this.resourceModelProviders;
- }
-
- protected ArrayList<JpaResourceModelProvider> buildResourceModelProviders() {
- ArrayList<JpaResourceModelProvider> providers = new ArrayList<JpaResourceModelProvider>();
- this.addResourceModelProvidersTo(providers);
- return providers;
- }
-
- protected abstract void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers);
-
-
- // ********** Java type mappings **********
-
- public synchronized Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions() {
- if (this.javaTypeMappingDefinitions == null) {
- this.javaTypeMappingDefinitions = this.buildJavaTypeMappingDefinitions();
- }
- return this.javaTypeMappingDefinitions;
- }
-
- protected ArrayList<JavaTypeMappingDefinition> buildJavaTypeMappingDefinitions() {
- ArrayList<JavaTypeMappingDefinition> definitions = new ArrayList<JavaTypeMappingDefinition>();
- this.addJavaTypeMappingDefinitionsTo(definitions);
- return definitions;
- }
-
- /**
- * To the specified list, add mapping definitions to use for analyzing the
- * mapping of a type given all annotations on it. The order is important,
- * as once a mapping definition tests positive for a
- * type, all following mapping definitions are ignored.
- */
- protected abstract void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions);
-
-
- // ********** Java attribute mappings **********
-
- public synchronized Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions() {
- if (this.defaultJavaAttributeMappingDefinitions == null) {
- this.defaultJavaAttributeMappingDefinitions = this.buildDefaultJavaAttributeMappingDefinitions();
- }
- return this.defaultJavaAttributeMappingDefinitions;
- }
-
- protected ArrayList<DefaultJavaAttributeMappingDefinition> buildDefaultJavaAttributeMappingDefinitions() {
- ArrayList<DefaultJavaAttributeMappingDefinition> definitions = new ArrayList<DefaultJavaAttributeMappingDefinition>();
- this.addDefaultJavaAttributeMappingDefinitionsTo(definitions);
- return definitions;
- }
-
- /**
- * To the specified list, add mapping definitions to use for analyzing the
- * default mapping of an attribute. The order is important,
- * as once a mapping definition tests positive for an attribute,
- * all following mapping definitions are ignored.
- */
- protected abstract void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions);
-
- public synchronized Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions() {
- if (this.specifiedJavaAttributeMappingDefinitions == null) {
- this.specifiedJavaAttributeMappingDefinitions = this.buildSpecifiedJavaAttributeMappingDefinitions();
- }
- return this.specifiedJavaAttributeMappingDefinitions;
- }
-
- protected ArrayList<JavaAttributeMappingDefinition> buildSpecifiedJavaAttributeMappingDefinitions() {
- ArrayList<JavaAttributeMappingDefinition> definitions = new ArrayList<JavaAttributeMappingDefinition>();
- this.addSpecifiedJavaAttributeMappingDefinitionsTo(definitions);
- return definitions;
- }
-
- /**
- * To the specified list, add mapping definitions to use for analyzing the
- * specified mapping of an attribute given all annotations on it. The order
- * is important, as once a mapping definition tests positive for an
- * attribute, all following mapping definitions are ignored.
- */
- protected abstract void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions);
-
-
- // ********** resource definitions **********
-
- public synchronized Iterable<ResourceDefinition> getResourceDefinitions() {
- if (this.resourceDefinitions == null) {
- this.resourceDefinitions = this.buildResourceDefinitions();
- }
- return this.resourceDefinitions;
- }
-
- protected ArrayList<ResourceDefinition> buildResourceDefinitions() {
- ArrayList<ResourceDefinition> definitions = new ArrayList<ResourceDefinition>();
- this.addResourceDefinitionsTo(definitions);
- return definitions;
- }
-
- protected abstract void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
deleted file mode 100644
index 80cc559c31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
+++ /dev/null
@@ -1,1928 +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.jpa.core.internal;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-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.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.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceModel;
-import org.eclipse.jpt.common.core.JptResourceModelListener;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryTypeCache;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceTypeCompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.common.core.resource.ResourceLocator;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackage;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageInfoCompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceTypeCache;
-import org.eclipse.jpt.common.utility.Command;
-import org.eclipse.jpt.common.utility.CommandExecutor;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.BitTools;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.ThreadLocalCommandExecutor;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.common.utility.internal.synchronizers.CallbackSynchronousSynchronizer;
-import org.eclipse.jpt.common.utility.internal.synchronizers.SynchronousSynchronizer;
-import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer;
-import org.eclipse.jpt.common.utility.synchronizers.Synchronizer;
-import org.eclipse.jpt.jpa.core.JpaDataSource;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0;
-import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.ConnectionProfile;
-import org.eclipse.jpt.jpa.db.Database;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * JPA project. Holds all the JPA stuff.
- *
- * The JPA platform provides the hooks for vendor-specific stuff.
- *
- * The JPA files are the "resource" model (i.e. objects that correspond directly
- * to Eclipse resources; e.g. Java source code files, XML files, JAR files).
- *
- * The root context node is the "context"model (i.e. objects that attempt to
- * model the JPA spec, using the "resource" model as an adapter to the Eclipse
- * resources).
- *
- * The data source is an adapter to the DTP meta-data model.
- */
-public abstract class AbstractJpaProject
- extends AbstractJpaNode
- implements JpaProject2_0
-{
- /**
- * The Eclipse project corresponding to the JPA project.
- */
- protected final IProject project;
-
- /**
- * The vendor-specific JPA platform that builds the JPA project
- * and all its contents.
- */
- protected final JpaPlatform jpaPlatform;
-
- /**
- * The JPA files associated with the JPA project:
- * persistence.xml
- * orm.xml
- * java
- */
- protected final Vector<JpaFile> jpaFiles = new Vector<JpaFile>();
-
- /**
- * The "external" Java resource compilation units (source). Populated upon demand.
- */
- protected final Vector<JavaResourceCompilationUnit> externalJavaResourceCompilationUnits = new Vector<JavaResourceCompilationUnit>();
-
- /**
- * The "external" Java resource types (binary). Populated upon demand.
- */
- protected final JavaResourceTypeCache externalJavaResourceTypeCache;
-
- /**
- * 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.externalJavaResourceTypeCache = this.buildExternalJavaResourceTypeCache();
-
- 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.externalJavaResourceTypeCache.addResourceModelListener(this.resourceModelListener);
- }
-
- @Override
- protected boolean requiresParent() {
- return false;
- }
-
- @Override
- public IResource getResource() {
- return this.project;
- }
-
- protected JavaResourceTypeCache buildExternalJavaResourceTypeCache() {
- return new BinaryTypeCache(this.jpaPlatform.getAnnotationProvider());
- }
-
- protected JpaRootContextNode buildRootContextNode() {
- return this.getJpaFactory().buildRootContextNode(this);
- }
-
-
- // ********** initial resource proxy visitor **********
-
- protected InitialResourceProxyVisitor buildInitialResourceProxyVisitor() {
- return new InitialResourceProxyVisitor();
- }
-
- protected class InitialResourceProxyVisitor implements IResourceProxyVisitor {
- protected InitialResourceProxyVisitor() {
- super();
- }
- protected void visitProject(IProject p) {
- try {
- p.accept(this, IResource.NONE);
- } catch (CoreException ex) {
- // shouldn't happen - we don't throw any CoreExceptions
- throw new RuntimeException(ex);
- }
- }
- // add a JPA file for every [appropriate] file encountered by the visitor
- public boolean visit(IResourceProxy resource) {
- switch (resource.getType()) {
- case IResource.ROOT : // shouldn't happen
- return true; // visit children
- case IResource.PROJECT :
- return true; // visit children
- case IResource.FOLDER :
- return true; // visit children
- case IResource.FILE :
- AbstractJpaProject.this.addJpaFile_((IFile) resource.requestResource());
- return false; // no children
- default :
- return false; // no children
- }
- }
- }
-
-
- // ********** misc **********
-
- /**
- * Ignore changes to this collection. Adds can be ignored since they are triggered
- * by requests that will, themselves, trigger updates (typically during the
- * update of an object that calls a setter with the newly-created resource
- * type). Deletes will be accompanied by manual updates.
- */
- @Override
- protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
- super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
- nonUpdateAspectNames.add(EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION);
- }
-
-
- // ********** general queries **********
-
- @Override
- public JpaProject getJpaProject() {
- return this;
- }
-
- public String getName() {
- return this.project.getName();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
- public IProject getProject() {
- return this.project;
- }
-
- public IJavaProject getJavaProject() {
- return JavaCore.create(this.project);
- }
-
- @Override
- public JpaPlatform getJpaPlatform() {
- return this.jpaPlatform;
- }
-
- @SuppressWarnings("unchecked")
- protected Iterable<JavaResourceCompilationUnit> getCombinedJavaResourceCompilationUnits() {
- return new CompositeIterable<JavaResourceCompilationUnit>(
- this.getInternalJavaResourceCompilationUnits(),
- this.getExternalJavaResourceCompilationUnits()
- );
- }
-
-
- // ********** database **********
-
- @Override
- public JpaDataSource getDataSource() {
- return this.dataSource;
- }
-
- public ConnectionProfile getConnectionProfile() {
- return this.dataSource.getConnectionProfile();
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public Catalog getDefaultDbCatalog() {
- String catalog = this.getDefaultCatalog();
- return (catalog == null) ? null : this.resolveDbCatalog(catalog);
- }
-
- public String getDefaultCatalog() {
- String catalog = this.getUserOverrideDefaultCatalog();
- return (catalog != null) ? catalog : this.getDatabaseDefaultCatalog();
- }
-
- protected String getDatabaseDefaultCatalog() {
- Database db = this.getDatabase();
- return (db == null ) ? null : db.getDefaultCatalogIdentifier();
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getDefaultDbSchemaContainer() {
- String catalog = this.getDefaultCatalog();
- return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
- }
-
- public Schema getDefaultDbSchema() {
- SchemaContainer sc = this.getDefaultDbSchemaContainer();
- return (sc == null) ? null : sc.getSchemaForIdentifier(this.getDefaultSchema());
- }
-
- public String getDefaultSchema() {
- String schema = this.getUserOverrideDefaultSchema();
- if (schema != null) {
- return schema;
- }
-
- String catalog = this.getDefaultCatalog();
- if (catalog == null) {
- // if there is no default catalog (either user-override or database-determined),
- // the database probably does not support catalogs;
- // return the database's default schema
- return this.getDatabaseDefaultSchema();
- }
-
- Catalog dbCatalog = this.resolveDbCatalog(catalog);
- if (dbCatalog != null) {
- return dbCatalog.getDefaultSchemaIdentifier();
- }
-
- // if we could not find a catalog on the database that matches the default
- // catalog name, return the database's default schema(?) - hmmm
- return this.getDatabaseDefaultSchema();
- }
-
- protected String getDatabaseDefaultSchema() {
- Database db = this.getDatabase();
- return (db == null ) ? null : db.getDefaultSchemaIdentifier();
- }
-
-
- // ********** user override default catalog **********
-
- public String getUserOverrideDefaultCatalog() {
- return this.userOverrideDefaultCatalog;
- }
-
- public void setUserOverrideDefaultCatalog(String catalog) {
- String old = this.userOverrideDefaultCatalog;
- this.userOverrideDefaultCatalog = catalog;
- JptJpaCorePlugin.setUserOverrideDefaultCatalog(this.project, catalog);
- this.firePropertyChanged(USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY, old, catalog);
- }
-
-
- // ********** user override default schema **********
-
- public String getUserOverrideDefaultSchema() {
- return this.userOverrideDefaultSchema;
- }
-
- public void setUserOverrideDefaultSchema(String schema) {
- String old = this.userOverrideDefaultSchema;
- this.userOverrideDefaultSchema = schema;
- JptJpaCorePlugin.setUserOverrideDefaultSchema(this.project, schema);
- this.firePropertyChanged(USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY, old, schema);
- }
-
-
- // ********** discover annotated classes **********
-
- public boolean discoversAnnotatedClasses() {
- return this.discoversAnnotatedClasses;
- }
-
- public void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses) {
- boolean old = this.discoversAnnotatedClasses;
- this.discoversAnnotatedClasses = discoversAnnotatedClasses;
- JptJpaCorePlugin.setDiscoverAnnotatedClasses(this.project, discoversAnnotatedClasses);
- this.firePropertyChanged(DISCOVERS_ANNOTATED_CLASSES_PROPERTY, old, discoversAnnotatedClasses);
- }
-
-
- // ********** JPA files **********
-
- public Iterable<JpaFile> getJpaFiles() {
- return new LiveCloneIterable<JpaFile>(this.jpaFiles); // read-only
- }
-
- public int getJpaFilesSize() {
- return this.jpaFiles.size();
- }
-
- protected Iterable<JpaFile> getJpaFiles(final IContentType contentType) {
- return new FilteringIterable<JpaFile>(this.getJpaFiles()) {
- @Override
- protected boolean accept(JpaFile jpaFile) {
- return jpaFile.getContentType().isKindOf(contentType);
- }
- };
- }
-
- @Override
- public JpaFile getJpaFile(IFile file) {
- for (JpaFile jpaFile : this.getJpaFiles()) {
- if (jpaFile.getFile().equals(file)) {
- return jpaFile;
- }
- }
- return null;
- }
-
- /**
- * Add a JPA file for the specified file, if appropriate.
- * Return true if a JPA File was created and added, false otherwise
- */
- protected boolean addJpaFile(IFile file) {
- JpaFile jpaFile = this.addJpaFile_(file);
- if (jpaFile != null) {
- this.fireItemAdded(JPA_FILES_COLLECTION, jpaFile);
- return true;
- }
- return false;
- }
-
- /**
- * Add a JPA file for the specified file, if appropriate, without firing
- * an event; useful during construction.
- * Return the new JPA file, null if it was not created.
- */
- protected JpaFile addJpaFile_(IFile file) {
- if (this.fileIsJavaRelated(file)) {
- if ( ! this.getJavaProject().isOnClasspath(file)) {
- return null; // java-related files must be on the Java classpath
- }
- }
- else if ( ! this.fileResourceLocationIsValid(file)) {
- return null;
- }
-
- JpaFile jpaFile = this.buildJpaFile(file);
- if (jpaFile == null) {
- return null;
- }
- jpaFile.getResourceModel().addResourceModelListener(this.resourceModelListener);
- this.jpaFiles.add(jpaFile);
- return jpaFile;
- }
-
- /**
- * <code>.java</code> or <code>.jar</code>
- */
- protected boolean fileIsJavaRelated(IFile file) {
- IContentType contentType = PlatformTools.getContentType(file);
- return (contentType != null) && this.contentTypeIsJavaRelated(contentType);
- }
-
- /**
- * pre-condition: content type is not <code>null</code>
- */
- protected boolean contentTypeIsJavaRelated(IContentType contentType) {
- return contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE) ||
- contentType.isKindOf(JptCommonCorePlugin.JAR_CONTENT_TYPE);
- }
-
- protected boolean fileResourceLocationIsValid(IFile file) {
- ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(this.getProject());
- return resourceLocator.acceptResourceLocation(this.getProject(), file.getParent());
- }
-
- /**
- * Log any developer exceptions and don't build a JPA file rather
- * than completely failing to build the JPA Project.
- */
- protected JpaFile buildJpaFile(IFile file) {
- try {
- return this.getJpaPlatform().buildJpaFile(this, file);
- } catch (Exception ex) {
- JptJpaCorePlugin.log(ex);
- return null;
- }
- }
-
- /**
- * Remove the JPA file corresponding to the specified IFile, if it exists.
- * Return true if a JPA File was removed, false otherwise
- */
- protected boolean removeJpaFile(IFile file) {
- JpaFile jpaFile = this.getJpaFile(file);
- if (jpaFile != null) { // a JpaFile is not added for every IFile
- this.removeJpaFile(jpaFile);
- return true;
- }
- return false;
- }
-
- /**
- * Stop listening to the JPA file and remove it.
- */
- protected void removeJpaFile(JpaFile jpaFile) {
- jpaFile.getResourceModel().removeResourceModelListener(this.resourceModelListener);
- if ( ! this.removeItemFromCollection(jpaFile, this.jpaFiles, JPA_FILES_COLLECTION)) {
- throw new IllegalArgumentException(jpaFile.toString());
- }
- }
-
-
- // ********** external Java resource types (source or binary) **********
-
- protected JavaResourceAbstractType buildExternalJavaResourceType(String typeName) {
- IType jdtType = this.findType(typeName);
- return (jdtType == null) ? null : this.buildExternalJavaResourceType(jdtType);
- }
-
- protected IType findType(String typeName) {
- try {
- return this.getJavaProject().findType(typeName);
- } catch (JavaModelException ex) {
- return null; // ignore exception?
- }
- }
-
- protected JavaResourceAbstractType buildExternalJavaResourceType(IType jdtType) {
- return jdtType.isBinary() ?
- this.buildBinaryExternalJavaResourceType(jdtType) :
- this.buildSourceExternalJavaResourceType(jdtType);
- }
-
- protected JavaResourceAbstractType buildBinaryExternalJavaResourceType(IType jdtType) {
- return this.externalJavaResourceTypeCache.addType(jdtType);
- }
-
- protected JavaResourceAbstractType buildSourceExternalJavaResourceType(IType jdtType) {
- JavaResourceCompilationUnit jrcu = this.getExternalJavaResourceCompilationUnit(jdtType.getCompilationUnit());
- String jdtTypeName = jdtType.getFullyQualifiedName('.'); // JDT member type names use '$'
- for (JavaResourceAbstractType jrat : jrcu.getTypes()) {
- if (jrat.getQualifiedName().equals(jdtTypeName)) {
- return jrat;
- }
- }
- // 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 JavaResourceTypeCache getExternalJavaResourceTypeCache() {
- return this.externalJavaResourceTypeCache;
- }
-
-
- // ********** external Java resource compilation units (source) **********
-
- public Iterable<JavaResourceCompilationUnit> getExternalJavaResourceCompilationUnits() {
- return new LiveCloneIterable<JavaResourceCompilationUnit>(this.externalJavaResourceCompilationUnits); // read-only
- }
-
- public int getExternalJavaResourceCompilationUnitsSize() {
- return this.externalJavaResourceCompilationUnits.size();
- }
-
- /**
- * Return the resource model compilation unit corresponding to the specified
- * JDT compilation unit. If it does not exist, build it.
- */
- protected JavaResourceCompilationUnit getExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
- for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) {
- if (jrcu.getCompilationUnit().equals(jdtCompilationUnit)) {
- // we will get here if the JRCU could not build its persistent type...
- return jrcu;
- }
- }
- return this.addExternalJavaResourceCompilationUnit(jdtCompilationUnit);
- }
-
- /**
- * Add an external Java resource compilation unit.
- */
- protected JavaResourceCompilationUnit addExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
- JavaResourceCompilationUnit jrcu = this.buildJavaResourceCompilationUnit(jdtCompilationUnit);
- this.addItemToCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION);
- jrcu.addResourceModelListener(this.resourceModelListener);
- return jrcu;
- }
-
- protected JavaResourceCompilationUnit buildJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) {
- return new SourceTypeCompilationUnit(
- jdtCompilationUnit,
- this.jpaPlatform.getAnnotationProvider(),
- this.jpaPlatform.getAnnotationEditFormatter(),
- this.modifySharedDocumentCommandExecutor
- );
- }
-
- protected boolean removeExternalJavaResourceCompilationUnit(IFile file) {
- for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) {
- if (jrcu.getFile().equals(file)) {
- this.removeExternalJavaResourceCompilationUnit(jrcu);
- return true;
- }
- }
- return false;
- }
-
- protected void removeExternalJavaResourceCompilationUnit(JavaResourceCompilationUnit jrcu) {
- jrcu.removeResourceModelListener(this.resourceModelListener);
- this.removeItemFromCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION);
- }
-
-
- // ********** context model **********
-
- public JpaRootContextNode getRootContextNode() {
- return this.rootContextNode;
- }
-
-
- // ********** utility **********
-
- public IFile getPlatformFile(IPath runtimePath) {
- return JptCommonCorePlugin.getPlatformFile(this.project, runtimePath);
- }
-
-
- // ********** XML files **********
-
- public JpaXmlResource getPersistenceXmlResource() {
- return (JpaXmlResource) this.getResourceModel(
- JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH,
- JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE
- );
- }
-
- public JpaXmlResource getDefaultOrmXmlResource() {
- return this.getMappingFileXmlResource(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
- }
-
- public JpaXmlResource getMappingFileXmlResource(IPath runtimePath) {
- return (JpaXmlResource) this.getResourceModel(runtimePath, JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
- }
-
- /**
- * If the specified file exists, is significant to the JPA project, and its
- * content is a "kind of" the specified content type, return the JPA
- * resource model corresponding to the file; otherwise, return null.
- */
- protected JptResourceModel getResourceModel(IPath runtimePath, IContentType contentType) {
- IFile file = this.getPlatformFile(runtimePath);
- return (file != null && file.exists()) ? this.getResourceModel(file, contentType) : null;
- }
-
- /**
- * If the specified file is significant to the JPA project and its content
- * is a "kind of" the specified content type, return the JPA resource model
- * corresponding to the file; otherwise, return null.
- */
- protected JptResourceModel getResourceModel(IFile file, IContentType contentType) {
- JpaFile jpaFile = this.getJpaFile(file);
- return (jpaFile == null) ? null : jpaFile.getResourceModel(contentType);
- }
-
-
- // ********** annotated Java source classes **********
-
- public Iterable<String> getAnnotatedJavaSourceClassNames() {
- return new TransformationIterable<JavaResourceAbstractType, String>(this.getInternalAnnotatedSourceJavaResourceTypes()) {
- @Override
- protected String transform(JavaResourceAbstractType jraType) {
- return jraType.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<JavaResourceAbstractType> getInternalAnnotatedSourceJavaResourceTypes() {
- return new FilteringIterable<JavaResourceAbstractType>(this.getInternalSourceJavaResourceTypes()) {
- @Override
- protected boolean accept(JavaResourceAbstractType jraType) {
- return jraType.isAnnotated(); // i.e. the type 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<JavaResourceAbstractType, String>(this.getInternalMappedSourceJavaResourceTypes()) {
- @Override
- protected String transform(JavaResourceAbstractType jraType) {
- return jraType.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<JavaResourceAbstractType> getInternalMappedSourceJavaResourceTypes() {
- return new FilteringIterable<JavaResourceAbstractType>(this.getInternalAnnotatedSourceJavaResourceTypes()) {
- @Override
- protected boolean accept(JavaResourceAbstractType jraType) {
- return jraType.isAnnotatedWith(getTypeMappingAnnotations());
- }
- };
- }
-
- public Iterable<String> getTypeMappingAnnotations() {
- return new TransformationIterable<JavaTypeMappingDefinition, String>(getJpaPlatform().getJavaTypeMappingDefinitions()) {
- @Override
- protected String transform(JavaTypeMappingDefinition o) {
- return o.getAnnotationName();
- }
- };
- }
-
- /**
- * 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<JavaResourceAbstractType> getInternalSourceJavaResourceTypes() {
- return new CompositeIterable<JavaResourceAbstractType>(this.getInternalSourceJavaResourceTypeLists());
- }
-
- /**
- * 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<JavaResourceAbstractType>> getInternalSourceJavaResourceTypeLists() {
- return new TransformationIterable<JavaResourceCompilationUnit, Iterable<JavaResourceAbstractType>>(this.getInternalJavaResourceCompilationUnits()) {
- @Override
- protected Iterable<JavaResourceAbstractType> transform(final JavaResourceCompilationUnit compilationUnit) {
- return compilationUnit.getTypes(); // *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 JavaResourceAbstractType getJavaResourceType(String typeName) {
- for (JavaResourceAbstractType jraType : this.getJavaResourceTypes()) {
- if (jraType.getQualifiedName().equals(typeName)) {
- return jraType;
- }
- }
- // if we don't have a type already, try to build new one from the project classpath
- return this.buildExternalJavaResourceType(typeName);
- }
-
- public JavaResourceAbstractType getJavaResourceType(String typeName, JavaResourceAbstractType.Kind kind) {
- JavaResourceAbstractType resourceType = getJavaResourceType(typeName);
- if (resourceType == null || resourceType.getKind() != kind) {
- return null;
- }
- return resourceType;
- }
-
-
- /**
- * return *all* the Java resource persistent types, including those in JARs referenced in
- * persistence.xml
- */
- protected Iterable<JavaResourceAbstractType> getJavaResourceTypes() {
- return new CompositeIterable<JavaResourceAbstractType>(this.getJavaResourceTypeSets());
- }
-
- /**
- * return *all* the Java resource persistent types, including those in JARs referenced in
- * persistence.xml
- */
- protected Iterable<Iterable<JavaResourceAbstractType>> getJavaResourceTypeSets() {
- return new TransformationIterable<JavaResourceNode.Root, Iterable<JavaResourceAbstractType>>(this.getJavaResourceNodeRoots()) {
- @Override
- protected Iterable<JavaResourceAbstractType> transform(final JavaResourceNode.Root root) {
- return root.getTypes(); // *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.externalJavaResourceTypeCache)
- );
- }
-
-
- // ********** 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<JavaResourceAbstractType> getGeneratedMetamodelTopLevelTypes() {
- if (this.metamodelSourceFolderName == null) {
- return EmptyIterable.instance();
- }
- final IPackageFragmentRoot genSourceFolder = this.getMetamodelPackageFragmentRoot();
- return new FilteringIterable<JavaResourceAbstractType>(this.getInternalSourceJavaResourceTypes()) {
- @Override
- protected boolean accept(JavaResourceAbstractType jrat) {
- return MetamodelTools.isGeneratedMetamodelTopLevelType(jrat, genSourceFolder);
- }
- };
- }
-
- public JavaResourceAbstractType getGeneratedMetamodelTopLevelType(IFile file) {
- JavaResourceCompilationUnit jrcu = this.getJavaResourceCompilationUnit(file);
- if (jrcu == null) {
- return null; // hmmm...
- }
- JavaResourceAbstractType primaryType = jrcu.getPrimaryType();
- if (primaryType == null) {
- return null; // no types in the file
- }
- return MetamodelTools.isGeneratedMetamodelTopLevelType(primaryType) ? primaryType : null;
- }
-
- protected JavaResourceCompilationUnit getJavaResourceCompilationUnit(IFile file) {
- return (JavaResourceCompilationUnit) this.getResourceModel(file, JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE);
- }
-
- public String getMetamodelSourceFolderName() {
- return this.metamodelSourceFolderName;
- }
-
- public void setMetamodelSourceFolderName(String folderName) {
- if (this.setMetamodelSourceFolderName_(folderName)) {
- JptJpaCorePlugin.setMetamodelSourceFolderName(this.project, folderName);
- if (folderName == null) {
- this.disposeMetamodel();
- } else {
- this.initializeMetamodel();
- }
- }
- }
-
- protected boolean setMetamodelSourceFolderName_(String folderName) {
- String old = this.metamodelSourceFolderName;
- this.metamodelSourceFolderName = folderName;
- return this.firePropertyChanged(METAMODEL_SOURCE_FOLDER_NAME_PROPERTY, old, folderName);
- }
-
- public void initializeMetamodel() {
- if (this.isJpa2_0Compatible()) {
- ((JpaRootContextNode2_0) this.rootContextNode).initializeMetamodel();
- }
- }
-
- /**
- * Synchronize the metamodel for 2.0-compatible JPA projects.
- */
- public void synchronizeMetamodel() {
- if (this.isJpa2_0Compatible()) {
- if (this.metamodelSourceFolderName != null) {
- ((JpaRootContextNode2_0) this.rootContextNode).synchronizeMetamodel();
- }
- }
- }
-
- public void disposeMetamodel() {
- if (this.isJpa2_0Compatible()) {
- ((JpaRootContextNode2_0) this.rootContextNode).disposeMetamodel();
- }
- }
-
- public IPackageFragmentRoot getMetamodelPackageFragmentRoot() {
- return this.getJavaProject().getPackageFragmentRoot(this.getMetaModelSourceFolder());
- }
-
- protected IFolder getMetaModelSourceFolder() {
- return this.getProject().getFolder(this.metamodelSourceFolderName);
- }
-
- /**
- * If the metamodel source folder is no longer a Java project source
- * folder, clear it out.
- */
- protected void checkMetamodelSourceFolderName() {
- if (this.metamodelSoureFolderNameIsInvalid()) {
- this.setMetamodelSourceFolderName(null);
- }
- }
-
- protected boolean metamodelSoureFolderNameIsInvalid() {
- return ! this.metamodelSourceFolderNameIsValid();
- }
-
- protected boolean metamodelSourceFolderNameIsValid() {
- return CollectionTools.contains(this.getJavaSourceFolderNames(), this.metamodelSourceFolderName);
- }
-
-
- // ********** Java source folder names **********
-
- public Iterable<String> getJavaSourceFolderNames() {
- try {
- return this.getJavaSourceFolderNames_();
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return EmptyIterable.instance();
- }
- }
-
- protected Iterable<String> getJavaSourceFolderNames_() throws JavaModelException {
- return new TransformationIterable<IPackageFragmentRoot, String>(this.getJavaSourceFolders()) {
- @Override
- protected String transform(IPackageFragmentRoot pfr) {
- try {
- return this.transform_(pfr);
- } catch (JavaModelException ex) {
- return "Error: " + pfr.getPath(); //$NON-NLS-1$
- }
- }
- private String transform_(IPackageFragmentRoot pfr) throws JavaModelException {
- return pfr.getUnderlyingResource().getProjectRelativePath().toString();
- }
- };
- }
-
- protected Iterable<IPackageFragmentRoot> getJavaSourceFolders() throws JavaModelException {
- return new FilteringIterable<IPackageFragmentRoot>(
- this.getPackageFragmentRoots(),
- SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER
- );
- }
-
- protected static final Filter<IPackageFragmentRoot> SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER =
- new Filter<IPackageFragmentRoot>() {
- public boolean accept(IPackageFragmentRoot pfr) {
- try {
- return this.accept_(pfr);
- } catch (JavaModelException ex) {
- return false;
- }
- }
- private boolean accept_(IPackageFragmentRoot pfr) throws JavaModelException {
- return pfr.exists() && (pfr.getKind() == IPackageFragmentRoot.K_SOURCE);
- }
- };
-
- protected Iterable<IPackageFragmentRoot> getPackageFragmentRoots() throws JavaModelException {
- return new ArrayIterable<IPackageFragmentRoot>(this.getJavaProject().getPackageFragmentRoots());
- }
-
-
- // ********** Java events **********
-
- // TODO handle changes to external projects
- public void javaElementChanged(ElementChangedEvent event) {
- this.processJavaDelta(event.getDelta());
- }
-
- /**
- * We recurse back here from {@link #processJavaDeltaChildren(IJavaElementDelta)}.
- */
- protected void processJavaDelta(IJavaElementDelta delta) {
- switch (delta.getElement().getElementType()) {
- case IJavaElement.JAVA_MODEL :
- this.processJavaModelDelta(delta);
- break;
- case IJavaElement.JAVA_PROJECT :
- this.processJavaProjectDelta(delta);
- break;
- case IJavaElement.PACKAGE_FRAGMENT_ROOT :
- this.processJavaPackageFragmentRootDelta(delta);
- break;
- case IJavaElement.PACKAGE_FRAGMENT :
- this.processJavaPackageFragmentDelta(delta);
- break;
- case IJavaElement.COMPILATION_UNIT :
- this.processJavaCompilationUnitDelta(delta);
- break;
- default :
- break; // ignore the elements inside a compilation unit
- }
- }
-
- protected void processJavaDeltaChildren(IJavaElementDelta delta) {
- for (IJavaElementDelta child : delta.getAffectedChildren()) {
- this.processJavaDelta(child); // recurse
- }
- }
-
- /**
- * Return whether the specified Java element delta is for a
- * {@link IJavaElementDelta#CHANGED CHANGED}
- * (as opposed to {@link IJavaElementDelta#ADDED ADDED} or
- * {@link IJavaElementDelta#REMOVED REMOVED}) Java element
- * and the specified flag is set.
- * (The delta flags are only significant if the delta
- * {@link IJavaElementDelta#getKind() kind} is
- * {@link IJavaElementDelta#CHANGED CHANGED}.)
- */
- protected boolean deltaFlagIsSet(IJavaElementDelta delta, int flag) {
- return (delta.getKind() == IJavaElementDelta.CHANGED) &&
- BitTools.flagIsSet(delta.getFlags(), flag);
- }
-
- // ***** model
- protected void processJavaModelDelta(IJavaElementDelta delta) {
- // process the Java model's projects
- this.processJavaDeltaChildren(delta);
- }
-
- // ***** project
- protected void processJavaProjectDelta(IJavaElementDelta delta) {
- // process the Java project's package fragment roots
- this.processJavaDeltaChildren(delta);
-
- // a classpath change can have pretty far-reaching effects...
- if (this.classpathHasChanged(delta)) {
- this.rebuild((IJavaProject) delta.getElement());
- }
- }
-
- /**
- * The specified Java project's classpath changed. Rebuild the JPA project
- * as appropriate.
- */
- protected void rebuild(IJavaProject javaProject) {
- // if the classpath has changed, we need to update everything since
- // class references could now be resolved (or not) etc.
- if (javaProject.equals(this.getJavaProject())) {
- this.removeDeadJpaFiles();
- this.checkMetamodelSourceFolderName();
- this.synchronizeWithJavaSource(this.getInternalJavaResourceCompilationUnits());
- } else {
- // TODO see if changed project is on our classpath?
- this.synchronizeWithJavaSource(this.getExternalJavaResourceCompilationUnits());
- }
- }
-
- /**
- * Loop through all our JPA files, remove any that are no longer on the
- * classpath.
- */
- protected void removeDeadJpaFiles() {
- for (JpaFile jpaFile : this.getJpaFiles()) {
- if (this.jpaFileIsDead(jpaFile)) {
- this.removeJpaFile(jpaFile);
- }
- }
- }
-
- protected boolean jpaFileIsDead(JpaFile jpaFile) {
- return ! this.jpaFileIsAlive(jpaFile);
- }
-
- /**
- * Sometimes (e.g. during tests), when a project has been deleted, we get a
- * Java change event that indicates the Java project is CHANGED (as
- * opposed to REMOVED, which is what typically happens). The event's delta
- * indicates that everything in the Java project has been deleted and the
- * classpath has changed. All entries in the classpath have been removed;
- * but single entry for the Java project's root folder has been added. (!)
- * This means any file in the project is on the Java project's classpath.
- * This classpath change is what triggers us to rebuild the JPA project; so
- * we put an extra check here to make sure the JPA file's resource file is
- * still present.
- * <p>
- * This would not be a problem if Dali received the resource change event
- * <em>before</em> JDT and simply removed the JPA project; but JDT receives
- * the resource change event first and converts it into the problematic
- * Java change event....
- */
- protected boolean jpaFileIsAlive(JpaFile jpaFile) {
- IFile file = jpaFile.getFile();
- return this.getJavaProject().isOnClasspath(file) &&
- file.exists();
- }
-
- /**
- * pre-condition:
- * delta.getElement().getElementType() == IJavaElement.JAVA_PROJECT
- */
- protected boolean classpathHasChanged(IJavaElementDelta delta) {
- return this.deltaFlagIsSet(delta, IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED);
- }
-
- protected void synchronizeWithJavaSource(Iterable<JavaResourceCompilationUnit> javaResourceCompilationUnits) {
- for (JavaResourceCompilationUnit javaResourceCompilationUnit : javaResourceCompilationUnits) {
- javaResourceCompilationUnit.synchronizeWithJavaSource();
- }
- }
-
- // ***** package fragment root
- protected void processJavaPackageFragmentRootDelta(IJavaElementDelta delta) {
- // process the Java package fragment root's package fragments
- this.processJavaDeltaChildren(delta);
-
- if (this.classpathEntryHasBeenAdded(delta)) {
- // TODO bug 277218
- } else if (this.classpathEntryHasBeenRemoved(delta)) { // should be mutually-exclusive w/added (?)
- // TODO bug 277218
- }
- }
-
- /**
- * pre-condition:
- * delta.getElement().getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT
- */
- protected boolean classpathEntryHasBeenAdded(IJavaElementDelta delta) {
- return this.deltaFlagIsSet(delta, IJavaElementDelta.F_ADDED_TO_CLASSPATH);
- }
-
- /**
- * pre-condition:
- * delta.getElement().getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT
- */
- protected boolean classpathEntryHasBeenRemoved(IJavaElementDelta delta) {
- return this.deltaFlagIsSet(delta, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH);
- }
-
- // ***** package fragment
- protected void processJavaPackageFragmentDelta(IJavaElementDelta delta) {
- // process the java package fragment's compilation units
- this.processJavaDeltaChildren(delta);
- }
-
- // ***** compilation unit
- protected void processJavaCompilationUnitDelta(IJavaElementDelta delta) {
- if (this.javaCompilationUnitDeltaIsRelevant(delta)) {
- ICompilationUnit compilationUnit = (ICompilationUnit) delta.getElement();
- for (JavaResourceCompilationUnit jrcu : this.getCombinedJavaResourceCompilationUnits()) {
- if (jrcu.getCompilationUnit().equals(compilationUnit)) {
- jrcu.synchronizeWithJavaSource();
- // TODO ? this.resolveJavaTypes(); // might have new member types now...
- break; // there *shouldn't* be any more...
- }
- }
- }
- // ignore the java compilation unit's children
- }
-
- protected boolean javaCompilationUnitDeltaIsRelevant(IJavaElementDelta delta) {
- // ignore changes to/from primary working copy - no content has changed;
- // and make sure there are no other flags set that indicate *both* a
- // change to/from primary working copy *and* content has changed
- if (BitTools.onlyFlagIsSet(delta.getFlags(), IJavaElementDelta.F_PRIMARY_WORKING_COPY)) {
- return false;
- }
-
- // ignore java notification for ADDED or REMOVED;
- // these are handled via resource notification
- return delta.getKind() == IJavaElementDelta.CHANGED;
- }
-
-
- // ********** validation **********
-
- public Iterable<IMessage> getValidationMessages(IReporter reporter) {
- List<IMessage> messages = new ArrayList<IMessage>();
- this.validate(messages, reporter);
- return new SnapshotCloneIterable<IMessage>(messages);
- }
-
- protected void validate(List<IMessage> messages, IReporter reporter) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
- this.validateLibraryProvider(messages);
- this.validateConnection(messages);
- this.rootContextNode.validate(messages, reporter);
- }
-
- protected void validateLibraryProvider(List<IMessage> messages) {
- try {
- this.validateLibraryProvider_(messages);
- } catch (CoreException ex) {
- JptJpaCorePlugin.log(ex);
- }
- }
-
- protected void validateLibraryProvider_(List<IMessage> messages) throws CoreException {
- Map<String, Object> enablementVariables = new HashMap<String, Object>();
- enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, getJpaPlatform().getId());
- enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, getJpaPlatform().getDescription());
-
- ILibraryProvider libraryProvider = LibraryProviderFramework.getCurrentProvider(getProject(), JpaFacet.FACET);
- IFacetedProject facetedProject = ProjectFacetsManager.create(getProject());
- IProjectFacetVersion facetVersion = facetedProject.getInstalledVersion(JpaFacet.FACET);
- if ( ! libraryProvider.isEnabledFor(facetedProject, facetVersion, enablementVariables)) {
- 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.externalJavaResourceTypeCache.removeTypes(file);
- }
- return false;
- }
-
- protected void resolveExternalJavaTypes() {
- for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) {
- jrcu.resolveTypes();
- }
- }
-
- // ***** resource delta visitors
- /**
- * add or remove a JPA file for every [appropriate] file encountered by the visitor
- */
- protected abstract class ResourceDeltaVisitor implements IResourceDeltaVisitor {
- protected boolean encounteredSignificantChange = false;
-
- protected ResourceDeltaVisitor() {
- super();
- }
-
- protected void visitDelta(IResourceDelta delta) {
- try {
- delta.accept(this);
- } catch (CoreException ex) {
- // shouldn't happen - we don't throw any CoreExceptions
- throw new RuntimeException(ex);
- }
- }
-
- public boolean visit(IResourceDelta delta) {
- IResource res = delta.getResource();
- switch (res.getType()) {
- case IResource.ROOT :
- return true; // visit children
- case IResource.PROJECT :
- return true; // visit children
- case IResource.FOLDER :
- return true; // visit children
- case IResource.FILE :
- this.fileChanged((IFile) res, delta.getKind());
- return false; // no children
- default :
- return false; // no children (probably shouldn't get here...)
- }
- }
-
- protected void fileChanged(IFile file, int deltaKind) {
- if (this.fileChangeIsSignificant(file, deltaKind)) {
- this.encounteredSignificantChange = true;
- }
- }
-
- protected abstract boolean fileChangeIsSignificant(IFile file, int deltaKind);
-
- /**
- * Return whether the visitor encountered some sort of "significant"
- * change while traversing the IResourceDelta
- * (e.g. a JPA file was added or removed).
- */
- protected boolean encounteredSignificantChange() {
- return this.encounteredSignificantChange;
- }
-
- }
-
-
- // ********** support for modifying documents shared with the UI **********
-
- public void setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor commandExecutor) {
- this.modifySharedDocumentCommandExecutor.set(commandExecutor);
- }
-
- public CommandExecutor getModifySharedDocumentCommandExecutor() {
- return this.modifySharedDocumentCommandExecutor;
- }
-
- protected ThreadLocalCommandExecutor buildModifySharedDocumentCommandExecutor() {
- return new ThreadLocalCommandExecutor();
- }
-
-
- // ********** synchronize context model with resource model **********
-
- public Synchronizer getContextModelSynchronizer() {
- return this.contextModelSynchronizer;
- }
-
- public void setContextModelSynchronizer(Synchronizer synchronizer) {
- if (synchronizer == null) {
- throw new NullPointerException();
- }
- this.contextModelSynchronizer.stop();
- this.setContextModelSynchronizer_(synchronizer);
- }
-
- protected void setContextModelSynchronizer_(Synchronizer synchronizer) {
- this.contextModelSynchronizer = synchronizer;
- this.contextModelSynchronizer.start();
- }
-
- /**
- * Delegate to the context model synchronizer so clients can configure how
- * synchronizations occur.
- */
- public void synchronizeContextModel() {
- this.synchronizingContextModel = true;
- this.contextModelSynchronizer.synchronize();
- this.synchronizingContextModel = false;
-
- // There are some changes to the resource model that will not change
- // the existing context model and trigger an update (e.g. adding an
- // @Entity annotation when the JPA project is automatically
- // discovering annotated classes); so we explicitly execute an update
- // here to discover those changes.
- this.update();
- }
-
- /**
- * Called by the context model synchronizer.
- */
- public IStatus synchronizeContextModel(IProgressMonitor monitor) {
- this.rootContextNode.synchronizeWithResourceModel();
- return Status.OK_STATUS;
- }
-
- public void synchronizeContextModelAndWait() {
- Synchronizer temp = this.contextModelSynchronizer;
- this.setContextModelSynchronizer(this.buildSynchronousContextModelSynchronizer());
- this.synchronizeContextModel();
- this.setContextModelSynchronizer(temp);
- }
-
-
- // ********** default context model synchronizer (synchronous) **********
-
- protected Synchronizer buildSynchronousContextModelSynchronizer() {
- return new SynchronousSynchronizer(this.buildSynchronousContextModelSynchronizerCommand());
- }
-
- protected Command buildSynchronousContextModelSynchronizerCommand() {
- return new SynchronousContextModelSynchronizerCommand();
- }
-
- protected class SynchronousContextModelSynchronizerCommand
- implements Command
- {
- public void execute() {
- AbstractJpaProject.this.synchronizeContextModel(new NullProgressMonitor());
- }
- }
-
-
- // ********** project "update" **********
-
- public CallbackSynchronizer getUpdateSynchronizer() {
- return this.updateSynchronizer;
- }
-
- public void setUpdateSynchronizer(CallbackSynchronizer synchronizer) {
- if (synchronizer == null) {
- throw new NullPointerException();
- }
- this.updateSynchronizer.stop();
- this.updateSynchronizer.removeListener(this.updateSynchronizerListener);
- this.setUpdateSynchronizer_(synchronizer);
- }
-
- protected void setUpdateSynchronizer_(CallbackSynchronizer synchronizer) {
- this.updateSynchronizer = synchronizer;
- this.updateSynchronizer.addListener(this.updateSynchronizerListener);
- this.updateSynchronizer.start();
- }
-
- @Override
- public void stateChanged() {
- super.stateChanged();
- this.update();
- }
-
- /**
- * The JPA project's state has changed, "update" those parts of the
- * JPA project that are dependent on other parts of the JPA project.
- * <p>
- * Delegate to the update synchronizer so clients can configure how
- * updates occur.
- * <p>
- * Ignore any <em>updates</em> that occur while we are synchronizing
- * the context model with the resource model because we will <em>update</em>
- * the context model at the completion of the <em>sync</em>. This is really
- * only useful for synchronous <em>syncs</em> and <em>updates</em>; since
- * the job scheduling rules will prevent the <em>sync</em> and
- * <em>update</em> jobs from running concurrently.
- *
- * @see #updateAndWait()
- */
- protected void update() {
- if ( ! this.synchronizingContextModel) {
- this.updateSynchronizer.synchronize();
- }
- }
-
- /**
- * Called by the update synchronizer.
- */
- public IStatus update(IProgressMonitor monitor) {
- this.rootContextNode.update();
- return Status.OK_STATUS;
- }
-
- /**
- * This is the callback used by the update synchronizer to notify the JPA
- * project that the "update" has quiesced (i.e. the "update" has completed
- * and there are no outstanding requests for further "updates").
- */
- public void updateQuiesced() {
- this.synchronizeMetamodel();
- }
-
- public void updateAndWait() {
- CallbackSynchronizer temp = this.updateSynchronizer;
- this.setUpdateSynchronizer(this.buildSynchronousUpdateSynchronizer());
- this.update();
- this.setUpdateSynchronizer(temp);
- }
-
-
- // ********** default update synchronizer (synchronous) **********
-
- protected CallbackSynchronizer buildSynchronousUpdateSynchronizer() {
- return new CallbackSynchronousSynchronizer(this.buildSynchronousUpdateSynchronizerCommand());
- }
-
- protected Command buildSynchronousUpdateSynchronizerCommand() {
- return new SynchronousUpdateSynchronizerCommand();
- }
-
- protected class SynchronousUpdateSynchronizerCommand
- implements Command
- {
- public void execute() {
- AbstractJpaProject.this.update(new NullProgressMonitor());
- }
- }
-
-
- // ********** update synchronizer listener **********
-
- protected CallbackSynchronizer.Listener buildUpdateSynchronizerListener() {
- return new UpdateSynchronizerListener();
- }
-
- protected class UpdateSynchronizerListener
- implements CallbackSynchronizer.Listener
- {
- public void synchronizationQuiesced(CallbackSynchronizer synchronizer) {
- AbstractJpaProject.this.updateQuiesced();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java
deleted file mode 100644
index 2e14d4d697..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.ForeignKey;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Singleton that delegates to the db object passed in.
- */
-public final class GenericEntityGeneratorDatabaseAnnotationNameBuilder
- implements EntityGeneratorDatabaseAnnotationNameBuilder
-{
- public static final EntityGeneratorDatabaseAnnotationNameBuilder INSTANCE
- = new GenericEntityGeneratorDatabaseAnnotationNameBuilder();
-
- public static EntityGeneratorDatabaseAnnotationNameBuilder instance() {
- return INSTANCE;
- }
-
- // ensure single instance
- private GenericEntityGeneratorDatabaseAnnotationNameBuilder() {
- super();
- }
-
- public String buildTableAnnotationName(String entityName, Table table) {
- return table.getIdentifier(entityName);
- }
-
- public String buildColumnAnnotationName(String attributeName, Column column) {
- return column.getIdentifier(attributeName);
- }
-
- public String buildJoinColumnAnnotationName(String attributeName, ForeignKey foreignKey) {
- return foreignKey.getJoinColumnAnnotationIdentifier(attributeName);
- }
-
- public String buildJoinColumnAnnotationName(Column column) {
- return column.getIdentifier();
- }
-
- public String buildJoinTableAnnotationName(Table table) {
- return table.getIdentifier();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java
deleted file mode 100644
index e1193d854a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java
+++ /dev/null
@@ -1,139 +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.jpa.core.internal;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverrideAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverridesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.BasicAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.ColumnAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorValueAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedIdAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EntityAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EnumeratedAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.GeneratedValueAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.IdAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.IdClassAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.InheritanceAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.JoinTableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.LobAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToManyAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToOneAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.MapKeyAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NamedQueriesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NamedQueryAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.OneToManyAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.OneToOneAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.OrderByAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTablesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.SequenceGeneratorAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.TableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.TableGeneratorAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.TemporalAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.TransientAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.VersionAnnotationDefinition;
-
-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 addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS);
- }
-
- protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
- AssociationOverridesAnnotationDefinition.instance(),
- AttributeOverridesAnnotationDefinition.instance(),
- BasicAnnotationDefinition.instance(),
- ColumnAnnotationDefinition.instance(),
- DiscriminatorColumnAnnotationDefinition.instance(),
- DiscriminatorValueAnnotationDefinition.instance(),
- EmbeddableAnnotationDefinition.instance(),
- EmbeddedAnnotationDefinition.instance(),
- EmbeddedIdAnnotationDefinition.instance(),
- EntityAnnotationDefinition.instance(),
- EnumeratedAnnotationDefinition.instance(),
- GeneratedValueAnnotationDefinition.instance(),
- IdAnnotationDefinition.instance(),
- IdClassAnnotationDefinition.instance(),
- InheritanceAnnotationDefinition.instance(),
- JoinColumnsAnnotationDefinition.instance(),
- JoinTableAnnotationDefinition.instance(),
- LobAnnotationDefinition.instance(),
- ManyToManyAnnotationDefinition.instance(),
- ManyToOneAnnotationDefinition.instance(),
- MapKeyAnnotationDefinition.instance(),
- MappedSuperclassAnnotationDefinition.instance(),
- NamedQueriesAnnotationDefinition.instance(),
- NamedNativeQueriesAnnotationDefinition.instance(),
- OneToManyAnnotationDefinition.instance(),
- OneToOneAnnotationDefinition.instance(),
- OrderByAnnotationDefinition.instance(),
- PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
- SecondaryTablesAnnotationDefinition.instance(),
- SequenceGeneratorAnnotationDefinition.instance(),
- TableAnnotationDefinition.instance(),
- TableGeneratorAnnotationDefinition.instance(),
- TemporalAnnotationDefinition.instance(),
- TransientAnnotationDefinition.instance(),
- VersionAnnotationDefinition.instance()
- };
-
- @Override
- protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS);
- }
-
- protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] {
- AssociationOverrideAnnotationDefinition.instance(),
- AttributeOverrideAnnotationDefinition.instance(),
- JoinColumnAnnotationDefinition.instance(),
- NamedQueryAnnotationDefinition.instance(),
- NamedNativeQueryAnnotationDefinition.instance(),
- PrimaryKeyJoinColumnAnnotationDefinition.instance(),
- SecondaryTableAnnotationDefinition.instance(),
- };
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
deleted file mode 100644
index 405d0914aa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java
+++ /dev/null
@@ -1,198 +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.jpa.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.AnnotationProvider;
-import org.eclipse.jpt.common.core.JptResourceModel;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.common.core.internal.utility.jdt.DefaultAnnotationEditFormatter;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter;
-import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.ResourceDefinition;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class GenericJpaPlatform
- implements JpaPlatform
-{
- private final String id;
-
- private final Version jpaVersion;
-
- private final JpaFactory jpaFactory;
-
- private final AnnotationProvider annotationProvider;
-
- private final JpaPlatformProvider platformProvider;
-
- private final JpaPlatformVariation jpaVariation;
-
-
- public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, AnnotationProvider annotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation) {
- super();
- this.id = id;
- this.jpaVersion = jpaVersion;
- this.jpaFactory = jpaFactory;
- this.annotationProvider = annotationProvider;
- this.jpaVariation = jpaVariation;
- this.platformProvider = platformProvider;
- }
-
-
- // ********** meta stuff **********
-
- public String getId() {
- return this.id;
- }
-
- public JpaPlatformDescription getDescription() {
- return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(this.getId());
- }
-
- public Version getJpaVersion() {
- return this.jpaVersion;
- }
-
-
- // ********** factory **********
-
- public JpaFactory getJpaFactory() {
- return this.jpaFactory;
- }
-
-
- // ********** platform providers **********
-
- protected JpaPlatformProvider getPlatformProvider() {
- return this.platformProvider;
- }
-
-
- // ********** JPA file/resource models **********
-
- public JpaFile buildJpaFile(JpaProject jpaProject, IFile file) {
- IContentType contentType = PlatformTools.getContentType(file);
- return (contentType == null) ? null : this.buildJpaFile(jpaProject, file, contentType);
- }
-
- protected JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType) {
- JptResourceModel resourceModel = this.buildResourceModel(jpaProject, file, contentType);
- return (resourceModel == null) ? null : this.jpaFactory.buildJpaFile(jpaProject, file, contentType, resourceModel);
- }
-
- protected JptResourceModel buildResourceModel(JpaProject jpaProject, IFile file, IContentType contentType) {
- JpaResourceModelProvider provider = this.getResourceModelProvider(contentType);
- return (provider == null) ? null : provider.buildResourceModel(jpaProject, file);
- }
-
- /**
- * Return null if we don't have a provider for the specified content type
- * (since we don't have control over the possible content types).
- */
- protected JpaResourceModelProvider getResourceModelProvider(IContentType contentType) {
- for (JpaResourceModelProvider provider : this.platformProvider.getResourceModelProviders()) {
- if (contentType.equals(provider.getContentType())) {
- return provider;
- }
- }
- return null;
- }
-
-
- // ********** Java annotations **********
-
- public AnnotationProvider getAnnotationProvider() {
- return this.annotationProvider;
- }
-
- public AnnotationEditFormatter getAnnotationEditFormatter() {
- return DefaultAnnotationEditFormatter.instance();
- }
-
-
- // ********** Java type mappings **********
-
- public Iterable<JavaTypeMappingDefinition> getJavaTypeMappingDefinitions() {
- return this.platformProvider.getJavaTypeMappingDefinitions();
- }
-
-
- // ********** Java attribute mappings **********
-
- public Iterable<JavaAttributeMappingDefinition> getSpecifiedJavaAttributeMappingDefinitions() {
- return this.platformProvider.getSpecifiedJavaAttributeMappingDefinitions();
- }
-
- public Iterable<DefaultJavaAttributeMappingDefinition> getDefaultJavaAttributeMappingDefinitions() {
- return this.platformProvider.getDefaultJavaAttributeMappingDefinitions();
- }
-
-
- // ********** resource types and definitions **********
-
- public boolean supportsResourceType(JptResourceType resourceType) {
- for (ResourceDefinition resourceDefinition : this.platformProvider.getResourceDefinitions()) {
- if (resourceDefinition.getResourceType().equals(resourceType)) {
- return true;
- }
- }
- return false;
- }
-
- public ResourceDefinition getResourceDefinition(JptResourceType resourceType) {
- for (ResourceDefinition resourceDefinition : this.platformProvider.getResourceDefinitions()) {
- if (resourceDefinition.getResourceType().equals(resourceType)) {
- return resourceDefinition;
- }
- }
- throw new IllegalArgumentException("Illegal resource type: " + resourceType); //$NON-NLS-1$
- }
-
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- return this.platformProvider.getMostRecentSupportedResourceType(contentType);
- }
-
-
- // ********** database **********
-
- public ConnectionProfileFactory getConnectionProfileFactory() {
- return JptJpaDbPlugin.getConnectionProfileFactory();
- }
-
- public EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder() {
- return GenericEntityGeneratorDatabaseAnnotationNameBuilder.instance();
- }
-
-
- // ********** validation **********
-
- public JpaPlatformVariation getJpaVariation() {
- return this.jpaVariation;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
deleted file mode 100644
index c3cacc7ae6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java
+++ /dev/null
@@ -1,96 +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.jpa.core.internal;
-
-import java.util.Comparator;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
-import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFactory;
-import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class GenericJpaPlatformFactory
- implements JpaPlatformFactory
-{
- /**
- * zero-argument constructor
- */
- public GenericJpaPlatformFactory() {
- super();
- }
-
- public JpaPlatform buildJpaPlatform(String id) {
- return new GenericJpaPlatform(
- id,
- this.buildJpaVersion(),
- new GenericJpaFactory(),
- new JpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()),
- GenericJpaPlatformProvider.instance(),
- this.buildJpaPlatformVariation());
- }
-
-
- private JpaPlatform.Version buildJpaVersion() {
- return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString());
- }
-
- protected JpaPlatformVariation buildJpaPlatformVariation() {
- return new JpaPlatformVariation() {
- public Supported getTablePerConcreteClassInheritanceIsSupported() {
- return Supported.MAYBE;
- }
- public boolean isJoinTableOverridable() {
- return false;
- }
- };
- }
-
-
- public static class SimpleVersion implements JpaPlatform.Version {
- protected final String jpaVersion;
-
- public static final Comparator<String> JPA_VERSION_COMPARATOR = new DefaultVersionComparator();
-
- public SimpleVersion(String jpaVersion) {
- super();
- this.jpaVersion = jpaVersion;
- }
-
- /**
- * The generic platform's version is the same as the JPA version.
- */
- public String getVersion() {
- return this.getJpaVersion();
- }
-
- public String getJpaVersion() {
- return this.jpaVersion;
- }
-
- /**
- * For now, generic platforms are backward-compatible.
- */
- public boolean isCompatibleWithJpaVersion(String version) {
- return JPA_VERSION_COMPARATOR.compare(this.jpaVersion, version) >= 0;
- }
-
- @Override
- public String toString() {
- return "JPA version: " + this.getJpaVersion(); //$NON-NLS-1$
- }
-
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java
deleted file mode 100644
index 7b5ef341a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.ResourceDefinition;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class GenericJpaPlatformProvider
- extends AbstractJpaPlatformProvider
-{
- // singleton
- private static final JpaPlatformProvider INSTANCE = new GenericJpaPlatformProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaPlatformProvider instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private GenericJpaPlatformProvider() {
- super();
- }
-
-
- // ********** resource models **********
-
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
- }
-
- @Override
- protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
- CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
- }
-
- // order should not be important here
- protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
- JavaResourceModelProvider.instance(),
- JarResourceModelProvider.instance(),
- PersistenceResourceModelProvider.instance(),
- OrmResourceModelProvider.instance()
- };
-
-
- // ********** Java type mappings **********
-
- @Override
- protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
- }
-
- // order matches that used by the Reference Implementation (EclipseLink)
- protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
- JavaEntityDefinition.instance(),
- JavaEmbeddableDefinition.instance(),
- JavaMappedSuperclassDefinition.instance()
- };
-
-
- // ********** Java attribute mappings **********
-
- @Override
- protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList<DefaultJavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
- }
-
- // order matches that used by the Reference Implementation (EclipseLink)
- protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] {
- JavaEmbeddedMappingDefinition.instance(),
- JavaBasicMappingDefinition.instance()
- };
-
- @Override
- protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList<JavaAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS);
- }
-
- // order matches that used by the Reference Implementation (EclipseLink)
- protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] {
- JavaTransientMappingDefinition.instance(),
- JavaIdMappingDefinition.instance(),
- JavaVersionMappingDefinition.instance(),
- JavaBasicMappingDefinition.instance(),
- JavaEmbeddedMappingDefinition.instance(),
- JavaEmbeddedIdMappingDefinition.instance(),
- JavaManyToManyMappingDefinition.instance(),
- JavaManyToOneMappingDefinition.instance(),
- JavaOneToManyMappingDefinition.instance(),
- JavaOneToOneMappingDefinition.instance()
- };
-
-
- // ********** resource definitions **********
-
- @Override
- protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
- CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
- }
-
- protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
- GenericPersistenceXmlDefinition.instance(),
- GenericOrmXmlDefinition.instance()
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java
deleted file mode 100644
index c7c8b0e4b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.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.jpa.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceModel;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryPackageFragmentRoot;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-
-/**
- * JAR files
- */
-public class JarResourceModelProvider
- implements JpaResourceModelProvider
-{
- // singleton
- private static final JpaResourceModelProvider INSTANCE = new JarResourceModelProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaResourceModelProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JarResourceModelProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCommonCorePlugin.JAR_CONTENT_TYPE;
- }
-
- /**
- * NB: Despite the check in GenericJpaProject.addJpaFile_(IFile),
- * we can get here and
- * the PFR will be null if the JAR is underneath a directory on the
- * classpath but the JAR itself is not on the classpath.
- * Returning null should be OK.
- */
- public JptResourceModel buildResourceModel(JpaProject jpaProject, IFile file) {
- IPackageFragmentRoot pfr = JavaCore.createJarPackageFragmentRootFrom(file);
- return (pfr ==null) ? null : new BinaryPackageFragmentRoot(pfr, jpaProject.getJpaPlatform().getAnnotationProvider());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
deleted file mode 100644
index 7221dd2af8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java
+++ /dev/null
@@ -1,71 +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.jpa.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourcePackageInfoCompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-
-/**
- * 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) {
- ICompilationUnit compilationUnit = JavaCore.createCompilationUnitFrom(file);
- try {
- if (compilationUnit.getPackageDeclarations().length > 0){
- return new SourcePackageInfoCompilationUnit(
- compilationUnit,
- jpaProject.getJpaPlatform().getAnnotationProvider(),
- jpaProject.getJpaPlatform().getAnnotationEditFormatter(),
- jpaProject.getModifySharedDocumentCommandExecutor());
- }
- //ignore package-info placed in default package as
- //it doesn't have package declaration and can't hold annotations
- return null;
- } catch (JavaModelException e) {
- JptJpaCorePlugin.log(e);
- // Ignore -- project is in a bad state. This will get recalled if necessary
- return null;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
deleted file mode 100644
index d248f7680e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java
+++ /dev/null
@@ -1,57 +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.jpa.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceTypeCompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-
-/**
- * Java source code
- */
-public class JavaResourceModelProvider
- implements JpaResourceModelProvider
-{
- // singleton
- private static final JpaResourceModelProvider INSTANCE = new JavaResourceModelProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaResourceModelProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JavaResourceModelProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE;
- }
-
- public JavaResourceCompilationUnit buildResourceModel(JpaProject jpaProject, IFile file) {
- return new SourceTypeCompilationUnit(
- JavaCore.createCompilationUnitFrom(file),
- jpaProject.getJpaPlatform().getAnnotationProvider(),
- jpaProject.getJpaPlatform().getAnnotationEditFormatter(),
- jpaProject.getModifySharedDocumentCommandExecutor()
- );
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaAnnotationProvider.java
deleted file mode 100644
index 2bcbb2c023..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaAnnotationProvider.java
+++ /dev/null
@@ -1,174 +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.jpa.core.internal;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.AnnotationProvider;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
-
-/**
- * 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 JpaAnnotationProvider
- implements AnnotationProvider
-{
- private final Iterable<JpaAnnotationDefinitionProvider> annotationDefinitionProviders;
-
-
- public JpaAnnotationProvider(JpaAnnotationDefinitionProvider... annotationDefinitionProviders) {
- super();
- this.annotationDefinitionProviders = new ArrayIterable<JpaAnnotationDefinitionProvider>(annotationDefinitionProviders);
- }
-
-
- // ********** type annotations **********
-
-
- public Iterable<String> getAnnotationNames() {
- return new TransformationIterable<AnnotationDefinition, String>(getAnnotationDefinitions()) {
- @Override
- protected String transform(AnnotationDefinition annotationDefinition) {
- return annotationDefinition.getAnnotationName();
- }
- };
- }
-
- public Iterable<String> getContainerAnnotationNames() {
- return new TransformationIterable<NestableAnnotationDefinition, String>(getNestableAnnotationDefinitions()) {
- @Override
- protected String transform(NestableAnnotationDefinition annotationDefinition) {
- return annotationDefinition.getContainerAnnotationName();
- }
- };
- }
-
- public Iterable<String> getNestableAnnotationNames() {
- return new TransformationIterable<NestableAnnotationDefinition, String>(getNestableAnnotationDefinitions()) {
- @Override
- protected String transform(NestableAnnotationDefinition annotationDefinition) {
- return annotationDefinition.getNestableAnnotationName();
- }
- };
- }
-
- protected Iterable<AnnotationDefinition> getAnnotationDefinitions() {
- return new CompositeIterable<AnnotationDefinition> (
- new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<AnnotationDefinition>>(this.annotationDefinitionProviders) {
- @Override
- protected Iterable<AnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.getAnnotationDefinitions();
- }
- }
- );
- }
-
- protected Iterable<NestableAnnotationDefinition> getNestableAnnotationDefinitions() {
- return new CompositeIterable<NestableAnnotationDefinition> (
- new TransformationIterable<JpaAnnotationDefinitionProvider, Iterable<NestableAnnotationDefinition>>(this.annotationDefinitionProviders) {
- @Override
- protected Iterable<NestableAnnotationDefinition> transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) {
- return annotationDefinitionProvider.getNestableAnnotationDefinitions();
- }
- }
- );
- }
-
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName) {
- return this.getAnnotationDefinition(annotationName).buildAnnotation(parent, element);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent, String annotationName) {
- return this.getAnnotationDefinition(annotationName).buildNullAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return this.getAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return this.getNestableAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation, index);
- }
-
- protected AnnotationDefinition getAnnotationDefinition(String annotationName) {
- AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getAnnotationDefinitions(), annotationName);
- if (annotationDefinition == null) {
- throw new IllegalArgumentException("unsupported annotation: " + annotationName); //$NON-NLS-1$
- }
- return annotationDefinition;
- }
-
-
- protected NestableAnnotationDefinition getNestableAnnotationDefinition(String annotationName) {
- NestableAnnotationDefinition annotationDefinition = this.selectNestableAnnotationDefinition(this.getNestableAnnotationDefinitions(), annotationName);
- if (annotationDefinition == null) {
- throw new IllegalArgumentException("unsupported nsetable annotation: " + annotationName); //$NON-NLS-1$
- }
- return annotationDefinition;
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName, int index) {
- return this.getNestableAnnotationDefinition(annotationName).buildAnnotation(parent, element, index);
- }
-
- public String getNestableAnnotationName(String containerAnnotationName) {
- return getNestableAnnotationDefinitionForContainer(containerAnnotationName).getNestableAnnotationName();
- }
-
- public String getContainerAnnotationName(String nestableAnnotationName) {
- return getNestableAnnotationDefinition(nestableAnnotationName).getContainerAnnotationName();
- }
-
- public String getNestableElementName(String nestableAnnotationName) {
- return getNestableAnnotationDefinition(nestableAnnotationName).getElementName();
- }
-
- private NestableAnnotationDefinition getNestableAnnotationDefinitionForContainer(String containerAnnotationName) {
- for (NestableAnnotationDefinition nestableAnnotationDefinition : getNestableAnnotationDefinitions()) {
- if (nestableAnnotationDefinition.getContainerAnnotationName().equals(containerAnnotationName)) {
- return nestableAnnotationDefinition;
- }
- }
- return null;
- }
-
-
- // ********** convenience methods **********
-
- protected AnnotationDefinition selectAnnotationDefinition(Iterable<AnnotationDefinition> annotationDefinitions, String annotationName) {
- for (AnnotationDefinition annotationDefinition : annotationDefinitions) {
- if (annotationDefinition.getAnnotationName().equals(annotationName)) {
- return annotationDefinition;
- }
- }
- return null;
- }
-
- protected NestableAnnotationDefinition selectNestableAnnotationDefinition(Iterable<NestableAnnotationDefinition> annotationDefinitions, String annotationName) {
- for (NestableAnnotationDefinition annotationDefinition : annotationDefinitions) {
- if (annotationDefinition.getNestableAnnotationName().equals(annotationName)) {
- return annotationDefinition;
- }
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java
deleted file mode 100644
index 985056b392..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
-
-public class JpaPlatformTester extends PropertyTester {
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (! (property.equals("jpaPlatform") || property.equals("jpaPlatformGroup"))
- || ! (expectedValue instanceof String)) { //$NON-NLS-1$
- return false;
- }
-
- JpaPlatformDescription platform = null;
-
- if (receiver instanceof IResource) {
- platform = platform(((IResource) receiver).getProject());
- }
- else if (receiver instanceof IJavaElement) {
- platform = platform(((IJavaElement) receiver).getResource().getProject());
- }
- else if (receiver instanceof JpaPlatformDescription) {
- platform = (JpaPlatformDescription) receiver;
- }
- else if (receiver instanceof JpaLibraryProviderInstallOperationConfig) {
- platform = ((JpaLibraryProviderInstallOperationConfig) receiver).getJpaPlatform();
- }
-
- if (property.equals("jpaPlatform")) {
- JpaPlatformDescription otherPlatform = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform((String) expectedValue);
- return platform == null ? false : platform.equals(otherPlatform);
- }
- if (property.equals("jpaPlatformGroup")) {
- JpaPlatformGroupDescription group = (platform == null) ? null : platform.getGroup();
- JpaPlatformGroupDescription otherGroup = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatformGroup((String) expectedValue);
- return group == null ? false : group.equals(otherGroup);
- }
- return false;
- }
-
- private JpaPlatformDescription platform(IProject project) {
- return (project == null)
- ? null
- : JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(JptJpaCorePlugin.getJpaPlatformId(project));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java
deleted file mode 100644
index fd62b02ccf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
-
-public class JpaTester extends PropertyTester {
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (!property.equals("projectFacet")) { //$NON-NLS-1$
- return false;
- }
- if (receiver instanceof IJavaElement) {
- IProject project = ((IJavaElement) receiver).getResource().getProject();
- if (project != null) {
-
- String val = (String) expectedValue;
- int colon = val.indexOf( ':' );
- String facetID;
- String facetVer;
- if( colon == -1 || colon == val.length() - 1 ) {
- facetID = val;
- facetVer = null;
- } else {
- facetID = val.substring( 0, colon );
- facetVer = val.substring( colon + 1 );
- }
- try {
- return FacetedProjectFramework.hasProjectFacet( project, facetID, facetVer );
- } catch (CoreException e) {
- JptJpaCorePlugin.log(e.getStatus());
- return false;
- }
- }
- }
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java
deleted file mode 100644
index eb5ec8c8ca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java
+++ /dev/null
@@ -1,69 +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.jpa.core.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Localized messages used by Dali core.
- */
-public class JptCoreMessages {
-
- public static String NONE;
- public static String VALIDATE_JOB;
- public static String VALIDATE_PROJECT_NOT_JPA;
- public static String VALIDATE_PROJECT_IMPROPER_PLATFORM;
- public static String VALIDATE_CONTAINER_QUESTIONABLE;
- public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED;
- public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION;
- public static String VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED;
- public static String VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT;
- public static String VALIDATE_PLATFORM_NOT_SPECIFIED;
- public static String VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION;
- public static String VALIDATE_LIBRARY_PROVIDER_INVALID;
- public static String VALIDATE_CONNECTION_NOT_SPECIFIED;
- public static String VALIDATE_CONNECTION_INVALID;
- public static String VALIDATE_CONNECTION_NOT_CONNECTED;
- public static String VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED;
- public static String VALIDATE_CONNECTION_DOESNT_CONTAIN_CATALOG;
- public static String VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED;
- public static String VALIDATE_CONNECTION_DOESNT_CONTAIN_SCHEMA;
- public static String VALIDATE_RUNTIME_NOT_SPECIFIED;
- public static String VALIDATE_RUNTIME_DOES_NOT_SUPPORT_EJB_30;
- public static String VALIDATE_LIBRARY_NOT_SPECIFIED;
- public static String SYNCHRONIZE_CLASSES_JOB;
- public static String SYNCHRONIZING_CLASSES_TASK;
- public static String INVALID_PERSISTENCE_XML_CONTENT;
- public static String ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE;
- public static String ERROR_WRITING_FILE;
- public static String REGISTRY_MISSING_ATTRIBUTE;
- public static String REGISTRY_INVALID_VALUE;
- public static String REGISTRY_DUPLICATE;
- public static String REGISTRY_FAILED_CLASS_LOAD;
- public static String REGISTRY_FAILED_INTERFACE_ASSIGNMENT;
- public static String REGISTRY_FAILED_INSTANTIATION;
- public static String CONTEXT_MODEL_SYNC_JOB_NAME;
- public static String UPDATE_JOB_NAME;
- public static String PLATFORM_ID_DOES_NOT_EXIST;
- public static String PREFERENCES_FLUSH_JOB_NAME;
- public static String OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND;
- public static String OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION;
-
- private static final String BUNDLE_NAME = "jpa_core"; //$NON-NLS-1$
- private static final Class<?> BUNDLE_CLASS = JptCoreMessages.class;
- static {
- NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
- }
-
- private JptCoreMessages() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java
deleted file mode 100644
index 124e5ce332..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-
-/**
- * orm.xml
- */
-public class OrmResourceModelProvider
- implements JpaResourceModelProvider
-{
- // singleton
- private static final JpaResourceModelProvider INSTANCE = new OrmResourceModelProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaResourceModelProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private OrmResourceModelProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
- public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
- return OrmXmlResourceProvider.getXmlResourceProvider(file).getXmlResource();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java
deleted file mode 100644
index 047e497f21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.resource.persistence.PersistenceXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-
-/**
- * persistence.xml
- */
-public class PersistenceResourceModelProvider
- implements JpaResourceModelProvider
-{
- // singleton
- private static final JpaResourceModelProvider INSTANCE = new PersistenceResourceModelProvider();
-
- /**
- * Return the singleton.
- */
- public static JpaResourceModelProvider instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private PersistenceResourceModelProvider() {
- super();
- }
-
- public IContentType getContentType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE;
- }
-
- public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) {
- return PersistenceXmlResourceProvider.getXmlResourceProvider(file).getXmlResource();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java
deleted file mode 100644
index 1e1d2cdba8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-
-/**
- * [Double-duty] factory to build adapters for either standard projects or
- * Java projects:
- * - JPA project
- *
- * See org.eclipse.jpt.jpa.core plugin.xml.
- */
-public class ProjectAdapterFactory
- implements IAdapterFactory
-{
- private static final Class<?>[] ADAPTER_LIST = new Class[] { JpaProject.class };
-
- public Class<?>[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
- public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) {
- if (adaptableObject instanceof IProject) {
- return this.getAdapter((IProject) adaptableObject, adapterType);
- }
- if (adaptableObject instanceof IJavaProject) {
- return this.getAdapter((IJavaProject) adaptableObject, adapterType);
- }
- return null;
- }
-
- private Object getAdapter(IProject project, Class <?>adapterType) {
- if (adapterType == JpaProject.class) {
- return this.getJpaProject(project);
- }
- return null;
- }
-
- private Object getAdapter(IJavaProject javaProject, Class <?>adapterType) {
- if (adapterType == JpaProject.class) {
- return this.getJpaProject(javaProject.getProject());
- }
- return null;
- }
-
- private JpaProject getJpaProject(IProject project) {
- return JptJpaCorePlugin.getJpaProject(project);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java
deleted file mode 100644
index 67535d5bb3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
-
-/**
- * Straightforward implementation of the JPA project config.
- */
-public class SimpleJpaProjectConfig implements JpaProject2_0.Config {
- protected IProject project;
- protected JpaPlatform jpaPlatform;
- protected String connectionProfileName;
- protected String userOverrideDefaultCatalog;
- protected String userOverrideDefaultSchema;
- protected boolean discoverAnnotatedClasses;
- protected String metamodelSourceFolderName;
-
- public SimpleJpaProjectConfig() {
- super();
- }
-
- public IProject getProject() {
- return this.project;
- }
-
- public void setProject(IProject project) {
- this.project = project;
- }
-
- public JpaPlatform getJpaPlatform() {
- return this.jpaPlatform;
- }
-
- public void setJpaPlatform(JpaPlatform jpaPlatform) {
- this.jpaPlatform = jpaPlatform;
- }
-
- public String getConnectionProfileName() {
- return this.connectionProfileName;
- }
-
- public void setConnectionProfileName(String connectionProfileName) {
- this.connectionProfileName = connectionProfileName;
- }
-
- public String getUserOverrideDefaultSchema() {
- return this.userOverrideDefaultSchema;
- }
-
- public void setUserOverrideDefaultSchema(String userOverrideDefaultSchema) {
- this.userOverrideDefaultSchema = userOverrideDefaultSchema;
- }
-
- public String getUserOverrideDefaultCatalog() {
- return this.userOverrideDefaultCatalog;
- }
-
- public void setUserOverrideDefaultCatalog(String userOverrideDefaultCatalog) {
- this.userOverrideDefaultCatalog = userOverrideDefaultCatalog;
- }
-
- public boolean discoverAnnotatedClasses() {
- return this.discoverAnnotatedClasses;
- }
-
- public void setDiscoverAnnotatedClasses(boolean discoverAnnotatedClasses) {
- this.discoverAnnotatedClasses = discoverAnnotatedClasses;
- }
-
- public String getMetamodelSourceFolderName() {
- return this.metamodelSourceFolderName;
- }
-
- public void setMetamodelSourceFolderName(String metamodelSourceFolderName) {
- this.metamodelSourceFolderName = metamodelSourceFolderName;
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.project.getName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java
deleted file mode 100644
index 22507e4026..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JpaNode;
-import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-
-public abstract class AbstractJpaContextNode
- extends AbstractJpaNode
- implements JpaContextNode
-{
- protected AbstractJpaContextNode(JpaNode parent) {
- super(parent);
- }
-
-
- // ********** synchronize/update **********
-
- public void synchronizeWithResourceModel() {
- // NOP
- }
-
- /**
- * convenience method
- */
- protected void synchronizeNodesWithResourceModel(Iterable<? extends JpaContextNode> nodes) {
- for (JpaContextNode node : nodes) {
- node.synchronizeWithResourceModel();
- }
- }
-
- public void update() {
- // NOP
- }
-
- /**
- * convenience method
- */
- protected void updateNodes(Iterable<? extends JpaContextNode> nodes) {
- for (JpaContextNode node : nodes) {
- node.update();
- }
- }
-
-
- // ********** containment hierarchy **********
-
- /**
- * covariant override
- */
- @Override
- public JpaContextNode getParent() {
- return (JpaContextNode) super.getParent();
- }
-
- /**
- * Overridden in:<ul>
- * <li>{@link org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode#getResourceType() AbstractJavaJpaContextNode}
- * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJarFile#getResourceType() GenericJarFile}
- * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml#getResourceType() GenericOrmXml}
- * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml#getResourceType() GenericPersistenceXml}
- * </ul>
- */
- public JptResourceType getResourceType() {
- return this.getParent().getResourceType();
- }
-
- /**
- * Overridden in:<ul>
- * <li>{@link org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#getPersistenceUnit() AbstractPersistenceUnit}
- * to return itself
- * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode#getPersistenceUnit() GenericRootContextNode}
- * to return <code>null</code>
- * </ul>
- */
- public PersistenceUnit getPersistenceUnit() {
- return this.getParent().getPersistenceUnit();
- }
-
- /**
- * Overridden in:<ul>
- * <li>{@link org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings#getMappingFileRoot() AbstractEntityMappings}
- * to return itself
- * <li>{@link org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode#getMappingFileRoot() GenericRootContextNode}
- * to return <code>null</code>
- * </ul>
- */
- public MappingFileRoot getMappingFileRoot() {
- return this.getParent().getMappingFileRoot();
- }
-
-
- // ********** database stuff **********
-
- public Schema getContextDefaultDbSchema() {
- SchemaContainer dbSchemaContainer = this.getContextDefaultDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getContextDefaultSchema());
- }
-
- protected String getContextDefaultSchema() {
- MappingFileRoot mfr = this.getMappingFileRoot();
- return (mfr != null) ? mfr.getSchema() : this.getPersistenceUnit().getDefaultSchema();
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getContextDefaultDbSchemaContainer() {
- String catalog = this.getContextDefaultCatalog();
- return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public Catalog getContextDefaultDbCatalog() {
- String catalog = this.getContextDefaultCatalog();
- return (catalog == null) ? null : this.resolveDbCatalog(catalog);
- }
-
- protected String getContextDefaultCatalog() {
- MappingFileRoot mfr = this.getMappingFileRoot();
- return (mfr != null) ? mfr.getCatalog() : this.getPersistenceUnit().getDefaultCatalog();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java
deleted file mode 100644
index 62314b55c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java
+++ /dev/null
@@ -1,65 +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.jpa.core.internal.context;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractXmlContextNode
- extends AbstractJpaContextNode
- implements XmlContextNode
-{
- protected AbstractXmlContextNode(JpaContextNode parent) {
- super(parent);
- }
-
-
- // ********** validation **********
-
- /**
- * All subclass implementations should be have a "super" call to this method.
- */
- public void validate(List<IMessage> messages, IReporter reporter) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
- }
-
- /**
- * Validate the specified node if it is not <code>null</code>.
- */
- protected void validateNode(XmlContextNode node, List<IMessage> messages, IReporter reporter) {
- if (node != null) {
- node.validate(messages, reporter);
- }
- }
-
- /**
- * Validate the specified nodes.
- */
- protected void validateNodes(Iterable<? extends XmlContextNode> nodes, List<IMessage> messages, IReporter reporter) {
- for (XmlContextNode node : nodes) {
- node.validate(messages, reporter);
- }
- }
-
- /**
- * Return the specified text range if it is not <code>null</code>; if it is
- * <code>null</code>, return the node's validation text range.
- */
- protected TextRange getValidationTextRange(TextRange textRange) {
- return (textRange != null) ? textRange : this.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java
deleted file mode 100644
index 796cb0e144..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-
-/**
- * Gather some of the behavior common to the Java and XML models. :-(
- */
-public final class AttributeMappingTools
-{
-
- // ********** all mapping names transformer **********
-
- public static final Transformer<AttributeMapping, Iterable<String>> ALL_MAPPING_NAMES_TRANSFORMER = new AllMappingNamesTransformer();
- static class AllMappingNamesTransformer
- implements Transformer<AttributeMapping, Iterable<String>>
- {
- public Iterable<String> transform(AttributeMapping mapping) {
- return mapping.getAllMappingNames();
- }
- }
-
-
- // ********** all overridable attribute mapping names transformer **********
-
- public static final Transformer<AttributeMapping, Iterable<String>> ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER = new AllOverridableAttributeMappingNamesTransformer();
- static class AllOverridableAttributeMappingNamesTransformer
- implements Transformer<AttributeMapping, Iterable<String>>
- {
- public Iterable<String> transform(AttributeMapping mapping) {
- return mapping.getAllOverridableAttributeMappingNames();
- }
- }
-
-
- // ********** all overridable association mapping names transformer **********
-
- public static final Transformer<AttributeMapping, Iterable<String>> ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER = new AllOverridableAssociationMappingNamesTransformer();
- static class AllOverridableAssociationMappingNamesTransformer
- implements Transformer<AttributeMapping, Iterable<String>>
- {
- public Iterable<String> transform(AttributeMapping mapping) {
- return mapping.getAllOverridableAssociationMappingNames();
- }
- }
-
-
- // ********** constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private AttributeMappingTools() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java
deleted file mode 100644
index 07cc664f27..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Interface to resolve text ranges on named columns
- */
-public interface BaseColumnTextRangeResolver extends NamedColumnTextRangeResolver
-{
- TextRange getTableTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java
deleted file mode 100644
index 8918e1ce48..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Interface to resolve text ranges on join columns
- */
-public interface BaseJoinColumnTextRangeResolver extends NamedColumnTextRangeResolver
-{
- TextRange getReferencedColumnNameTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java
deleted file mode 100644
index f8c958501b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-
-/**
- * Utility methods for manipulating context containers.
- */
-public class ContextContainerTools {
-
- /**
- * Adapter used to synchronize a context container with its corresponding
- * resource container.
- *
- * @param <C> the type of context elements
- * @param <R> the type of resource elements
- */
- public interface Adapter<C extends JpaContextNode, R> {
-
- /**
- * Return the container's context elements.
- */
- Iterable<C> getContextElements();
-
- /**
- * Return the container's current set of resource elements.
- * These are what the context elements will be synchronized to.
- */
- Iterable<R> getResourceElements();
-
- /**
- * Return the resource element corresponding to the specified context
- * element.
- */
- R getResourceElement(C contextElement);
-
- /**
- * Move the specified context element to the specified index.
- */
- void moveContextElement(int index, C element);
-
- /**
- * Add a context element for the specified resource element at the
- * specified index.
- */
- void addContextElement(int index, R resourceElement);
-
- /**
- * Remove the specified context element from the container.
- */
- void removeContextElement(C element);
- }
-
-
- /**
- * Using the specified adapter, synchronize a context container with its
- * corresponding resource container: moving, removing, and adding elements
- * as necessary.
- * <p>
- * We can do this because:<ul>
- * <li>the XML translators will <em>move</em> the EMF elements when
- * appropriate (as opposed to simply rebuilding them in place).
- * <li>the Java resource model will re-use existing annotations when
- * appropriate (as opposed to simply rebuilding them in place).
- * </ul>
- */
- public static <C extends JpaContextNode, R> void synchronizeWithResourceModel(Adapter<C, R> adapter) {
- sync(adapter, true); // true = sync
- }
-
- /**
- * @see #synchronizeWithResourceModel(Adapter)
- */
- public static <C extends JpaContextNode, R> void update(Adapter<C, R> adapter) {
- sync(adapter, false); // false = update
- }
-
- /**
- * The specified <code>sync</code> flag controls whether any surviving
- * context nodes are either <em>synchronized</em> (<code>true</code>) or
- * <em>updated</em> (<code>false</code>).
- */
- protected static <C extends JpaContextNode, R> void sync(Adapter<C, R> adapter, boolean sync) {
- HashSet<C> contextElements = CollectionTools.set(adapter.getContextElements());
- ArrayList<C> contextElementsToSync = new ArrayList<C>(contextElements.size());
- int resourceIndex = 0;
-
- for (R resourceElement : adapter.getResourceElements()) {
- boolean match = false;
- for (Iterator<C> stream = contextElements.iterator(); stream.hasNext(); ) {
- C contextElement = stream.next();
- if (Tools.valuesAreEqual(adapter.getResourceElement(contextElement), resourceElement)) {
- // we don't know the source index because the element has been moved by previously moved elements
- adapter.moveContextElement(resourceIndex, contextElement);
- stream.remove();
- // TODO perform update here someday...
- contextElementsToSync.add(contextElement);
- match = true;
- break;
- }
- }
- if ( ! match) {
- // added elements are sync'ed during construction or will be
- // updated during the next "update" (which is triggered by
- // their addition to the model)
- adapter.addContextElement(resourceIndex, resourceElement);
- }
- resourceIndex++;
- }
- // remove any leftover context elements
- for (C contextElement : contextElements) {
- adapter.removeContextElement(contextElement);
- }
- // TODO bjv
- // take care of the structural changes before sync'ing the remaining elements;
- // we might be able to do this inline once we get rid of the "list change" events
- // and go with only add, remove, etc. list events
- // (these syncs will trigger "list change" events with list aspect adapters, which
- // trigger refreshes of UI adapters (e.g. TableModelAdapter) which will prematurely
- // discover any structural changes... :( )
- // see ItemAspectListValueModelAdapter.itemAspectChanged(EventObject)
- for (C contextElement : contextElementsToSync) {
- if (sync) {
- contextElement.synchronizeWithResourceModel();
- } else {
- contextElement.update();
- }
- }
- }
-
- private ContextContainerTools() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java
deleted file mode 100644
index 19b118f3b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-
-public interface EntityTextRangeResolver
- extends PrimaryKeyTextRangeResolver
-{
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java
deleted file mode 100644
index 5c7ac1ede2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-/**
- * Interface to resolve text ranges on join columns
- */
-public interface JoinColumnTextRangeResolver
- extends BaseJoinColumnTextRangeResolver, BaseColumnTextRangeResolver
-{
- // combine interfaces
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java
deleted file mode 100644
index 9b3ecb21a5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java
+++ /dev/null
@@ -1,44 +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.jpa.core.internal.context;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public interface JptValidator
-{
- /**
- * Return whether the client should continue validating.
- */
- boolean validate(List<IMessage> messages, IReporter reporter);
-
-
- final class Null
- implements JptValidator
- {
- private static final JptValidator INSTANCE = new Null();
- public static JptValidator instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Null() {
- super();
- }
- public boolean validate(List<IMessage> messages, IReporter reporter) {
- return true; // continue validating
- }
- @Override
- public String toString() {
- return StringTools.buildSingletonToString(this);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
deleted file mode 100644
index 93c14529e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java
+++ /dev/null
@@ -1,445 +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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.ColumnMapping;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.JoinTable;
-import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.ReferenceTable;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.CollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.ElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Gather some of the behavior common to the Java and XML models. :-(
- */
-public final class MappingTools {
-
- /**
- * Default join table name from the JPA spec:<br>
- * "The concatenated names of the two associated primary
- * entity tables, separated by a underscore."
- * <pre>
- * [owning table name]_[target table name]
- * </pre>
- * <strong>NB:</strong> The <em>names</em> are concatenated,
- * <em>not</em> the <em>identifiers</em>.
- * E.g. the join table for <code>"Foo"</code> and <code>"baR"</code>
- * (where the "delimited" identifier is required) is:
- * <pre>
- * "Foo_baR"
- * </pre>
- * not
- * <pre>
- * "Foo"_"baR"
- * </pre>
- * As a result, we cannot honestly calculate the default name without a
- * database connection. We need the database to convert the resulting name
- * to an identifier appropriate to the current database.
- */
- public static String buildJoinTableDefaultName(ReadOnlyRelationship relationship) {
- if (relationship.getJpaProject().getDataSource().connectionProfileIsActive()) {
- return buildDbJoinTableDefaultName(relationship);
- }
- // continue with a "best effort":
- String owningTableName = relationship.getTypeMapping().getPrimaryTableName();
- if (owningTableName == null) {
- return null;
- }
- RelationshipMapping relationshipMapping = relationship.getMapping();
- if (relationshipMapping == null) {
- return null;
- }
- Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
- if (targetEntity == null) {
- return null;
- }
- String targetTableName = targetEntity.getPrimaryTableName();
- if (targetTableName == null) {
- return null;
- }
- return owningTableName + '_' + targetTableName;
- }
-
- /**
- * Use the database to build a more accurate default name.
- */
- private static String buildDbJoinTableDefaultName(ReadOnlyRelationship relationship) {
- Table owningTable = relationship.getTypeMapping().getPrimaryDbTable();
- if (owningTable == null) {
- return null;
- }
- RelationshipMapping relationshipMapping = relationship.getMapping();
- if (relationshipMapping == null) {
- return null;
- }
- Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
- if (targetEntity == null) {
- return null;
- }
- Table targetTable = targetEntity.getPrimaryDbTable();
- if (targetTable == null) {
- return null;
- }
- String name = owningTable.getName() + '_' + targetTable.getName();
- return owningTable.getDatabase().convertNameToIdentifier(name);
- }
-
- /**
- * Default collection table name from the JPA spec:<br>
- * "The concatenation of the name of the containing entity and
- * the name of the collection attribute, separated by an underscore."
- * <pre>
- * [owning entity name]_[attribute name]
- * </pre>
- */
- public static String buildCollectionTableDefaultName(ElementCollectionMapping2_0 mapping) {
- Entity entity = mapping.getEntity();
- if (entity == null) {
- return null;
- }
- String owningEntityName = entity.getName();
- String attributeName = mapping.getName();
- return owningEntityName + '_' + attributeName;
- }
-
- /**
- * Return the join column's default name;
- * which is typically<pre>
- * [attribute name]_[referenced column name]
- * </pre>
- * But, if we don't have an attribute name (e.g. in a unidirectional
- * one-to-many or many-to-many) is<pre>
- * [target entity name]_[referenced column name]
- * </pre>
- * @see #buildJoinTableDefaultName(ReadOnlyRelationship)
- */
- public static String buildJoinColumnDefaultName(ReadOnlyJoinColumn joinColumn, ReadOnlyJoinColumn.Owner owner) {
- if (owner.getJoinColumnsSize() != 1) {
- return null;
- }
- String prefix = owner.getAttributeName();
- if (prefix == null) {
- Entity targetEntity = owner.getRelationshipTarget();
- if (targetEntity == null) {
- return null;
- }
- prefix = targetEntity.getName();
- }
- // It's not clear which of these is correct....
- // The spec implies that the referenced column is always the
- // *primary key* column of the target entity; i.e. the primary key as
- // defined on the *database* (or, possibly, the primary key as defined
- // by the target entity's Id mapping?), not the name of the referenced
- // column irrespective of whether it is the primary key on the target
- // entity's table. But this seems like it would be wrong; since the
- // referenced column need not be a primary key and we don't always have
- // access to the database.
- //
- // Column targetColumn = joinColumn.getTargetPrimaryKeyDbColumn();
- String targetColumnName = joinColumn.getReferencedColumnName();
- if (targetColumnName == null) {
- return null;
- }
- String name = prefix + '_' + targetColumnName;
- // Again, it's not clear 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 : targetEntity.getPersistentType().getAllAttributes()) {
- 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.getJoinColumnsSize() != 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 (ReadOnlyPersistentAttribute persAttribute : persistentType.getAllAttributes()) {
- 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 (AttributeMapping attributeMapping : typeMapping.getAllAttributeMappings()) {
- 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 : overridableTypeMapping.getInheritanceHierarchy()) {
- 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 : overridableTypeMapping.getInheritanceHierarchy()) {
- 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 nodesArePotentalDuplicates_(node1, node2) &&
- ! node1.overrides(node2) &&
- ! node2.overrides(node1);
- }
-
- /**
- * Return whether the specified nodes<ul>
- * <li>are <em>not</em> the same node
- * <li>have the same non-empty name
- * <li>are in the same persistence unit
- * </ul>
- */
- private static <T extends JpaNamedContextNode<? super T>> boolean nodesArePotentalDuplicates_(T node1, T node2) {
- return (node1 != node2) &&
- StringTools.stringIsNotEmpty(node1.getName()) &&
- node1.getName().equals(node2.getName()) &&
- (node1.getPersistenceUnit() == node2.getPersistenceUnit());
- }
-
- /**
- * 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 nodesArePotentalDuplicates_(node1, node2) &&
- 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 (ReadOnlyPersistentAttribute attribute : entity.getPersistentType().getAllAttributes()) {
- String current = attribute.getPrimaryKeyColumnName();
- if (current != null) {
- // 229423 - if the attribute is a primary key, but it has an attribute override,
- // use the override column instead
- ReadOnlyAttributeOverride attributeOverride = entity.getAttributeOverrideContainer().getOverrideNamed(attribute.getName());
- if (attributeOverride != null) {
- current = attributeOverride.getColumn().getName();
- }
- }
- if (pkColumnName == null) {
- pkColumnName = current;
- } else {
- if (current != null) {
- // if we encounter a composite primary key, return null
- return null;
- }
- }
- }
- // if we encounter only a single primary key column name, return it
- return pkColumnName;
- }
-
- /**
- * "Unqualify" the specified attribute name, removing the mapping's name
- * from the front of the attribute name if it is present. For example, if
- * the mapping's name is <code>"foo"</code>, the attribute name
- * <code>"foo.bar"</code> would be converted to <code>"bar"</code>).
- * Return <code>null</code> if the attribute name cannot be "unqualified".
- */
- public static String unqualify(String mappingName, String attributeName) {
- if (mappingName == null) {
- return null;
- }
- if ( ! attributeName.startsWith(mappingName)) {
- return null;
- }
- int mappingNameLength = mappingName.length();
- if (attributeName.length() <= mappingNameLength) {
- return null;
- }
- return (attributeName.charAt(mappingNameLength) == '.') ? attributeName.substring(mappingNameLength + 1) : null;
- }
-
- /**
- * This transformer will prepend a specified qualifier, followed by a
- * dot ('.'), to a string. For example, if a mapping's name is
- * <code>"foo"</code> and one of its attribute's is named
- * <code>"bar"</code>, the attribute's name will be transformed
- * into <code>"foo.bar"</code>. If the specified qualifier is
- * <code>null</code> (or an empty string), only a dot will be prepended
- * to a string.
- */
- public static class QualifierTransformer
- implements Transformer<String, String>
- {
- private final String prefix;
- public QualifierTransformer(String qualifier) {
- super();
- this.prefix = (qualifier == null) ? "." : qualifier + '.'; //$NON-NLS-1$
- }
- public String transform(String s) {
- return this.prefix + s;
- }
- }
-
-
- // ********** constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private MappingTools() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java
deleted file mode 100644
index da477387e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Interface to resolve text ranges on named columns
- */
-public interface NamedColumnTextRangeResolver
-{
- TextRange getNameTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java
deleted file mode 100644
index 901eae1c02..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Interface to resolve text ranges on named columns
- */
-public interface OverrideTextRangeResolver
-{
- TextRange getNameTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java
deleted file mode 100644
index 7620a04d2e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-
-public class PersistentAttributePropertyTester
- extends PropertyTester
-{
- public static final String IS_MAPPED = "isMapped"; //$NON-NLS-1$
-
- public static final String IS_VIRTUAL = "isVirtual"; //$NON-NLS-1$
-
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (property == null) {
- return false;
- }
- if ( ! (expectedValue instanceof Boolean)) {
- return false;
- }
- return this.test_(receiver, property, ((Boolean) expectedValue).booleanValue());
- }
-
- /**
- * pre-condition: property is not <code>null</code>
- */
- protected boolean test_(Object receiver, String property, boolean expected) {
- if (property.equals(IS_MAPPED)) {
- boolean actual = ((ReadOnlyPersistentAttribute) receiver).getMapping().getKey() != null;
- return actual == expected;
- }
- if (property.equals(IS_VIRTUAL)) {
- boolean actual = ((ReadOnlyPersistentAttribute) receiver).isVirtual();
- return actual == expected;
- }
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java
deleted file mode 100644
index a2345cc459..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Interface to resolve text ranges on persistent attributes
- */
-public interface PersistentAttributeTextRangeResolver
-{
- TextRange getAttributeTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java
deleted file mode 100644
index 8a759ea107..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Interface to resolve text ranges on persistent type mappings that can define primary keys
- */
-public interface PrimaryKeyTextRangeResolver extends TypeMappingTextRangeResolver
-{
-
- TextRange getIdClassTextRange();
-
- TextRange getAttributeMappingTextRange(String attributeName);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java
deleted file mode 100644
index adb744dcfd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java
+++ /dev/null
@@ -1,24 +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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Interface to resolve text ranges on tables.
- */
-public interface TableTextRangeResolver
-{
- TextRange getNameTextRange();
-
- TextRange getSchemaTextRange();
-
- TextRange getCatalogTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java
deleted file mode 100644
index a30cac215c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-
-/**
- * Interface to resolve text ranges on persistent type mappings
- */
-public interface TypeMappingTextRangeResolver
-{
- TextRange getTypeMappingTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java
deleted file mode 100644
index f9b0287c3a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java
+++ /dev/null
@@ -1,175 +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.jpa.core.internal.context;
-
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0;
-
-/**
- * Gather some of the behavior common to the Java and XML models. :-(
- */
-public class TypeMappingTools {
-
- // ********** single relationship mappings **********
-
- /**
- * Return whether the specified attribute is a derived ID for the specified
- * type mapping.
- */
- public static boolean attributeIsDerivedId(TypeMapping typeMapping, String attributeName) {
- if (attributeName == null) {
- return false;
- }
- // the attribute name may be qualified - we test only the first attribute name
- int dotIndex = attributeName.indexOf('.');
- attributeName = (dotIndex == -1) ? attributeName : attributeName.substring(0, dotIndex);
- return CollectionTools.contains(getMapsIdDerivedIdAttributeNames(typeMapping), attributeName);
- }
-
- /**
- * Return the names of all the ID attributes derived from
- * single-relationship mappings for the specified type mapping
- * (i.e. the names of the ID attributes that are specified by a single-
- * relationship mapping's "maps ID" setting).
- */
- protected static Iterable<String> getMapsIdDerivedIdAttributeNames(TypeMapping typeMapping) {
- return new TransformationIterable<MapsIdDerivedIdentityStrategy2_0, String>(getMapsIdDerivedIdentityStrategies(typeMapping)) {
- @Override
- protected String transform(MapsIdDerivedIdentityStrategy2_0 strategy) {
- return strategy.getIdAttributeName();
- }
- };
- }
-
- /**
- * Return all the single-relationship "maps ID" derived identity strategies
- * for the specified type mapping.
- */
- protected static Iterable<MapsIdDerivedIdentityStrategy2_0> getMapsIdDerivedIdentityStrategies(TypeMapping typeMapping) {
- return new TransformationIterable<DerivedIdentity2_0, MapsIdDerivedIdentityStrategy2_0>(getMapsIdDerivedIdentities(typeMapping)) {
- @Override
- protected MapsIdDerivedIdentityStrategy2_0 transform(DerivedIdentity2_0 derivedIdentity) {
- return derivedIdentity.getMapsIdDerivedIdentityStrategy();
- }
- };
- }
-
- /**
- * Return all the single-relationship "maps ID" derived identities for the
- * specified type mapping.
- */
- protected static Iterable<DerivedIdentity2_0> getMapsIdDerivedIdentities(TypeMapping typeMapping) {
- return new FilteringIterable<DerivedIdentity2_0>(getDerivedIdentities(typeMapping)) {
- @Override
- protected boolean accept(DerivedIdentity2_0 derivedIdentity) {
- return derivedIdentity.usesMapsIdDerivedIdentityStrategy();
- }
- };
- }
-
- /**
- * Return all the single-relationship derived identities for the specified
- * type mapping.
- */
- protected static Iterable<DerivedIdentity2_0> getDerivedIdentities(TypeMapping typeMapping) {
- return new TransformationIterable<SingleRelationshipMapping2_0, DerivedIdentity2_0>(getSingleRelationshipMappings(typeMapping)) {
- @Override
- protected DerivedIdentity2_0 transform(SingleRelationshipMapping2_0 mapping) {
- return mapping.getDerivedIdentity();
- }
- };
- }
-
- /**
- * Return all the single-relationship attribute mappings for the specified
- * type mapping.
- */
- 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, Iterable<AttributeMapping>> ATTRIBUTE_MAPPINGS_TRANSFORMER = new AttributeMappingsTransformer();
- static class AttributeMappingsTransformer
- implements Transformer<TypeMapping, Iterable<AttributeMapping>>
- {
- public Iterable<AttributeMapping> transform(TypeMapping mapping) {
- return mapping.getAttributeMappings();
- }
- }
-
-
- // ********** associated tables transformer **********
-
- public static final Transformer<TypeMapping, Iterable<ReadOnlyTable>> ASSOCIATED_TABLES_TRANSFORMER = new AssociatedTablesTransformer();
- static class AssociatedTablesTransformer
- implements Transformer<TypeMapping, Iterable<ReadOnlyTable>>
- {
- public Iterable<ReadOnlyTable> transform(TypeMapping mapping) {
- return mapping.getAssociatedTables();
- }
- }
-
-
- // ********** overridable attribute names transformer **********
-
- public static final Transformer<TypeMapping, Iterable<String>> OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER = new OverridableAttributeNamesTransformer();
- static class OverridableAttributeNamesTransformer
- implements Transformer<TypeMapping, Iterable<String>>
- {
- public Iterable<String> transform(TypeMapping mapping) {
- return mapping.getOverridableAttributeNames();
- }
- }
-
-
- // ********** overridable association names transformer **********
-
- public static final Transformer<TypeMapping, Iterable<String>> OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER = new OverridableAssociationNamesTransformer();
- static class OverridableAssociationNamesTransformer
- implements Transformer<TypeMapping, Iterable<String>>
- {
- public Iterable<String> transform(TypeMapping mapping) {
- return mapping.getOverridableAssociationNames();
- }
- }
-
-
- // ********** constructor **********
-
- /**
- * Suppress default constructor, ensuring non-instantiability.
- */
- private TypeMappingTools() {
- super();
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractAccessor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractAccessor.java
deleted file mode 100644
index 6b330606f3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractAccessor.java
+++ /dev/null
@@ -1,268 +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.jpa.core.internal.context.java;
-
-import java.util.HashMap;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNode;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.Accessor;
-
-public abstract class AbstractAccessor
- extends AbstractJavaJpaContextNode
- implements Accessor
-{
-
- protected AbstractAccessor(ReadOnlyPersistentAttribute parent) {
- super(parent);
- }
-
-
- // ********** unannotated Java resource member **********
-
- /**
- * Wrap another Java resource member and suppress all its annotations.
- */
- protected abstract class UnannotatedJavaResourceMember<M extends JavaResourceMember>
- extends SourceNode
- implements JavaResourceMember
- {
- protected final M member;
-
- /**
- * these are built as needed
- */
- protected final HashMap<String, Annotation> nullAnnotationsCache = new HashMap<String, Annotation>();
-
-
- protected UnannotatedJavaResourceMember(M member) {
- super(member.getParent());
- this.member = member;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // NOP
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // NOP
- }
-
-
- // ********** annotations **********
-
- public Iterable<Annotation> getAnnotations() {
- return EmptyIterable.instance();
- }
-
- public int getAnnotationsSize() {
- 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 ListIterable<NestableAnnotation> getAnnotations(String nestableAnnotationName) {
- return EmptyListIterable.instance();
- }
-
- public int getAnnotationsSize(String nestableAnnotationName) {
- return 0;
- }
-
- public NestableAnnotation getAnnotation(int index, String nestableAnnotationName) {
- return null;
- }
-
- public Annotation addAnnotation(String annotationName) {
- throw new UnsupportedOperationException();
- }
-
- public NestableAnnotation addAnnotation(int index, String nestableAnnotationName) {
- 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) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable<String> supportingAnnotationNames) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** misc **********
-
- public boolean isAnnotated() {
- return false;
- }
-
- public boolean isAnnotatedWith(Iterable<String> annotationNames) {
- return false;
- }
-
- public boolean isFinal() {
- return this.member.isFinal();
- }
-
- public boolean isPublic() {
- return this.member.isPublic();
- }
-
- public boolean isStatic() {
- return this.member.isStatic();
- }
-
- public boolean isTransient() {
- return this.member.isTransient();
- }
-
- public boolean isFor(String memberName, int occurrence) {
- return this.member.isFor(memberName, occurrence);
- }
-
- public TextRange getTextRange(CompilationUnit astRoot) {
- // should never be null
- return this.member.getTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- // should never be null
- return this.member.getNameTextRange(astRoot);
- }
-
- public void resolveTypes(CompilationUnit astRoot) {
- // NOP
- }
- }
-
- // ********** unannotated Java resource attribute **********
-
- /**
- * Wrap another Java resource attribute and suppress all its annotations.
- */
- protected abstract class UnannotatedJavaResourceAttribute<A extends JavaResourceAttribute>
- extends UnannotatedJavaResourceMember<A>
- implements JavaResourceAttribute
- {
- public UnannotatedJavaResourceAttribute(A 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().buildNullAnnotation(this, annotationName);
- }
-
-
- // ********** delegated behavior **********
-
- @Override
- public JavaResourceType getParent() {
- return this.member.getParent();
- }
-
- public JavaResourceType getResourceType() {
- return this.member.getResourceType();
- }
-
- public String getName() {
- return this.member.getName();
- }
-
- 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 boolean typeIsArray() {
- return this.member.typeIsArray();
- }
-
- public ListIterable<String> getTypeSuperclassNames() {
- return this.member.getTypeSuperclassNames();
- }
-
- public Iterable<String> getTypeInterfaceNames() {
- return this.member.getTypeInterfaceNames();
- }
-
- public ListIterable<String> getTypeTypeArgumentNames() {
- return this.member.getTypeTypeArgumentNames();
- }
-
- public int getTypeTypeArgumentNamesSize() {
- return this.member.getTypeTypeArgumentNamesSize();
- }
-
- public String getTypeTypeArgumentName(int index) {
- return this.member.getTypeTypeArgumentName(index);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
deleted file mode 100644
index 949ba1c367..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
+++ /dev/null
@@ -1,322 +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.jpa.core.internal.context.java;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.ColumnMapping;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.SimpleMetamodelField;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java attribute mapping
- * <p>
- * The mapping annotation is <code>null</code> for default mappings.
- * It will be faulted into existence whenever {@link #getAnnotationForUpdate()}
- * is called. It will <em>not</em> return to <code>null</code> automatically
- * when all its state is defaulted; it must be explicitly cleared via
- * {@link JavaPersistentAttribute#setMappingKey(String)}.
- */
-public abstract class AbstractJavaAttributeMapping<A extends Annotation>
- extends AbstractJavaJpaContextNode
- implements JavaAttributeMapping, AttributeMapping2_0
-{
- protected boolean default_;
-
-
- protected AbstractJavaAttributeMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.default_ = this.buildDefault();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.updateDefault();
- }
-
- @Override
- public void update() {
- super.update();
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.getPersistentAttribute().getName();
- }
-
-
- // ********** annotation **********
-
- @SuppressWarnings("unchecked")
- public A getMappingAnnotation() {
- return (A) this.getAnnotation_();
- }
-
- protected Annotation getAnnotation_() {
- return this.getResourceAttribute().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 JavaResourceAttribute getResourceAttribute() {
- return this.getPersistentAttribute().getResourceAttribute();
- }
-
- 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);
- }
-
- protected JavaPersistentAttribute getJavaPersistentAttribute() {
- return this.getPersistentAttribute().getJavaPersistentAttribute();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ********** embedded mappings **********
-
- public Iterable<String> getAllMappingNames() {
- return new SingleElementIterable<String>(this.getName());
- }
-
- public Iterable<String> getAllOverridableAttributeMappingNames() {
- return this.isOverridableAttributeMapping() ?
- new SingleElementIterable<String>(this.getName()) :
- EmptyIterable.<String>instance();
- }
-
- public Iterable<String> getAllOverridableAssociationMappingNames() {
- return this.isOverridableAssociationMapping() ?
- new SingleElementIterable<String>(this.getName()) :
- EmptyIterable.<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.getPersistentAttribute().getValidationTextRange(astRoot);
- }
-
- protected TextRange getMappingAnnotationTextRange(CompilationUnit astRoot) {
- A annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java
deleted file mode 100644
index f0199d6275..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java
+++ /dev/null
@@ -1,363 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaBaseColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
-
-/**
- * Java column or join column
- */
-public abstract class AbstractJavaBaseColumn<A extends BaseColumnAnnotation, O extends JavaReadOnlyBaseColumn.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) {
- return this.getValidationTextRange(this.getColumnAnnotation().getTableTextRange(astRoot), 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?
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.tableTouches(pos, astRoot)) {
- return this.getJavaCandidateTableNames(filter);
- }
- return null;
- }
-
- protected boolean tableTouches(int pos, CompilationUnit astRoot) {
- return this.getColumnAnnotation().tableTouches(pos, astRoot);
- }
-
- protected Iterable<String> getJavaCandidateTableNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateTableNames(filter));
- }
-
- protected Iterable<String> getCandidateTableNames(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateTableNames(), filter);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.owner.getCandidateTableNames();
- }
-
-
- // ********** validation **********
-
- public boolean tableNameIsInvalid() {
- return this.owner.tableNameIsInvalid(this.getTable());
- }
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
- return new JavaBaseColumnTextRangeResolver(this, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
deleted file mode 100644
index 76bac34d47..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java
+++ /dev/null
@@ -1,322 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.AttributeOverride;
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> embedded or embedded ID mapping
- */
-public abstract class AbstractJavaBaseEmbeddedMapping<A extends Annotation>
- extends AbstractJavaAttributeMapping<A>
- implements JavaBaseEmbeddedMapping
-{
- protected final JavaAttributeOverrideContainer attributeOverrideContainer;
-
- protected Embeddable targetEmbeddable;
-
-
- protected AbstractJavaBaseEmbeddedMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.attributeOverrideContainer = this.buildAttributeOverrideContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.attributeOverrideContainer.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.attributeOverrideContainer.update();
- this.setTargetEmbeddable(this.buildTargetEmbeddable());
- }
-
-
- // ********** attribute override container **********
-
- public JavaAttributeOverrideContainer getAttributeOverrideContainer() {
- return this.attributeOverrideContainer;
- }
-
- protected JavaAttributeOverrideContainer buildAttributeOverrideContainer() {
- return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildAttributeOverrideContainerOwner());
- }
-
- protected abstract JavaAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner();
-
-
- // ********** 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 Iterable<String> getAllOverridableAttributeMappingNames() {
- return this.isJpa2_0Compatible() ?
- this.getEmbeddableOverridableAttributeMappingNames() :
- super.getAllOverridableAttributeMappingNames();
- }
-
- protected Iterable<String> getEmbeddableOverridableAttributeMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
- }
-
- @Override
- public Iterable<String> getAllOverridableAssociationMappingNames() {
- return this.isJpa2_0Compatible() ?
- this.getEmbeddableOverridableAssociationMappingNames() :
- super.getAllOverridableAssociationMappingNames();
- }
-
- protected Iterable<String> getEmbeddableOverridableAssociationMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<String> getQualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<String, String>(this.getEmbeddableAttributeMappingNames(transformer), this.buildQualifierTransformer());
- }
-
- protected Iterable<String> getEmbeddableAttributeMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new CompositeIterable<String>(this.getEmbeddableAttributeMappingNamesLists(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 Iterable<Iterable<String>> getEmbeddableAttributeMappingNamesLists(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getEmbeddableAttributeMappings(), transformer);
- }
-
- /**
- * Return the target embeddable's attribute mappings.
- */
- protected Iterable<AttributeMapping> getEmbeddableAttributeMappings() {
- return ((this.targetEmbeddable != null) && (this.targetEmbeddable != this.getTypeMapping())) ?
- this.targetEmbeddable.getAttributeMappings() :
- EmptyIterable.<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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.attributeOverrideContainer.getJavaCompletionProposals(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 abstract class AttributeOverrideContainerOwner
- implements JavaAttributeOverrideContainer2_0.Owner
- {
- public JavaResourceMember getResourceMember() {
- return AbstractJavaBaseEmbeddedMapping.this.getResourceAttribute();
- }
-
- public TypeMapping getTypeMapping() {
- return AbstractJavaBaseEmbeddedMapping.this.getTypeMapping();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return AbstractJavaBaseEmbeddedMapping.this.getTargetEmbeddable();
- }
-
- public Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? this.getAllOverridableAttributeNames_(overriddenTypeMapping) : EmptyIterable.<String>instance();
- }
-
- /**
- * pre-condition: type mapping is not <code>null</code>
- * <p>
- * NB: Overridden in {@link GenericJavaEmbeddedIdMapping.AttributeOverrideContainerOwner}
- */
- protected Iterable<String> getAllOverridableAttributeNames_(TypeMapping overriddenTypeMapping) {
- return overriddenTypeMapping.getAllOverridableAttributeNames();
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- 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 buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AttributeOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
- }
-
- protected JavaPersistentAttribute getPersistentAttribute() {
- return AbstractJavaBaseEmbeddedMapping.this.getPersistentAttribute();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java
deleted file mode 100644
index be2893ecb6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java
+++ /dev/null
@@ -1,382 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.Association;
-import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-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) {
- JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
- 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() {
- JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
- 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.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
- }
-
- public void removeColumnAnnotation() {
- this.getResourceAttribute().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 Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.column.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.converter.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.column.validate(messages, reporter, astRoot);
- this.converter.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java
deleted file mode 100644
index 991d67b0d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-
-/**
- * Java embeddable type mapping
- */
-public abstract class AbstractJavaEmbeddable
- extends AbstractJavaTypeMapping<EmbeddableAnnotation>
- implements JavaEmbeddable
-{
- protected AbstractJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) {
- super(parent, mappingAnnotation);
- }
-
- public String getKey() {
- return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- public JavaPersistentType getIdClass() {
- return null;
- }
-
- public boolean isMapped() {
- return true;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- @Override
- public boolean validatesAgainstDatabase() {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
deleted file mode 100644
index 684ccbfe3e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java
+++ /dev/null
@@ -1,1703 +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.jpa.core.internal.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.NotNullFilter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaPlatformVariation.Supported;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AssociationOverride;
-import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.AttributeOverride;
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.InheritanceType;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.SecondaryTable;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaTable;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.DiscriminatorColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityPrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MappedSuperclassOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTableValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.TableValidator;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java entity
- */
-public abstract class AbstractJavaEntity
- extends AbstractJavaTypeMapping<EntityAnnotation>
- implements JavaEntity, JavaCacheableHolder2_0, JavaGeneratorContainer.Owner, JavaQueryContainer.Owner
-{
- protected String specifiedName;
- protected String defaultName;
-
- protected Entity rootEntity;
- protected final Vector<Entity> descendants = new Vector<Entity>();
-
- protected final JavaIdClassReference idClassReference;
-
- protected final JavaTable table;
- protected boolean specifiedTableIsAllowed;
- protected boolean tableIsUndefined;
-
- protected final ContextListContainer<JavaSecondaryTable, SecondaryTableAnnotation> specifiedSecondaryTableContainer;
- protected final Table.Owner specifiedSecondaryTableOwner;
-
- protected final PrimaryKeyJoinColumnOwner primaryKeyJoinColumnOwner;
- protected final ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation> specifiedPrimaryKeyJoinColumnContainer;
- 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.specifiedSecondaryTableContainer = this.buildSpecifiedSecondaryTableContainer();
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.specifiedPrimaryKeyJoinColumnContainer = this.buildSpecifiedPrimaryKeyJoinColumnContainer();
- 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.updateSpecifiedSecondaryTables();
-
- this.updateDefaultPrimaryKeyJoinColumn();
- this.updateSpecifiedPrimaryKeyJoinColumns();
-
- 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.getJavaResourceType().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 ListIterable<JavaSecondaryTable> getSecondaryTables() {
- return this.getSpecifiedSecondaryTables();
- }
-
- public int getSecondaryTablesSize() {
- return this.getSpecifiedSecondaryTablesSize();
- }
-
-
- // ********** specified secondary tables **********
-
- public ListIterable<JavaSecondaryTable> getSpecifiedSecondaryTables() {
- return this.specifiedSecondaryTableContainer.getContextElements();
- }
-
- public int getSpecifiedSecondaryTablesSize() {
- return this.specifiedSecondaryTableContainer.getContextElementsSize();
- }
-
- public JavaSecondaryTable addSpecifiedSecondaryTable() {
- return this.addSpecifiedSecondaryTable(this.getSpecifiedSecondaryTablesSize());
- }
-
- public JavaSecondaryTable addSpecifiedSecondaryTable(int index) {
- SecondaryTableAnnotation annotation = this.addSecondaryTableAnnotation(index);
- return this.specifiedSecondaryTableContainer.addContextElement(index, annotation);
- }
-
- protected SecondaryTableAnnotation addSecondaryTableAnnotation(int index) {
- return (SecondaryTableAnnotation) this.getJavaResourceType().addAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME);
- }
-
- public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) {
- this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTableContainer.indexOfContextElement((JavaSecondaryTable) secondaryTable));
- }
-
- public void removeSpecifiedSecondaryTable(int index) {
- this.getJavaResourceType().removeAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME);
- this.specifiedSecondaryTableContainer.removeContextElement(index);
- }
-
- public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
- this.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, SecondaryTableAnnotation.ANNOTATION_NAME);
- this.specifiedSecondaryTableContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected JavaSecondaryTable buildSecondaryTable(SecondaryTableAnnotation secondaryTableAnnotation) {
- return this.getJpaFactory().buildJavaSecondaryTable(this, this.specifiedSecondaryTableOwner, secondaryTableAnnotation);
- }
-
- protected void syncSpecifiedSecondaryTables() {
- this.specifiedSecondaryTableContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedSecondaryTables() {
- this.specifiedSecondaryTableContainer.update();
- }
-
- protected ListIterable<SecondaryTableAnnotation> getSecondaryTableAnnotations() {
- return this.getSecondaryTableAnnotations_();
- }
-
- protected ListIterable<SecondaryTableAnnotation> getSecondaryTableAnnotations_() {
- return new SubListIterableWrapper<NestableAnnotation, SecondaryTableAnnotation>(this.getNestableSecondaryTableAnnotations_());
- }
-
- protected ListIterable<NestableAnnotation> getNestableSecondaryTableAnnotations_() {
- return this.getResourceAnnotatedElement().getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME);
- }
-
- protected ContextListContainer<JavaSecondaryTable, SecondaryTableAnnotation> buildSpecifiedSecondaryTableContainer() {
- return new SpecifiedSecondaryTableContainer();
- }
-
- /**
- * specified secondary table container
- */
- protected class SpecifiedSecondaryTableContainer
- extends ContextListContainer<JavaSecondaryTable, SecondaryTableAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_SECONDARY_TABLES_LIST;
- }
- @Override
- protected JavaSecondaryTable buildContextElement(SecondaryTableAnnotation resourceElement) {
- return AbstractJavaEntity.this.buildSecondaryTable(resourceElement);
- }
- @Override
- protected ListIterable<SecondaryTableAnnotation> getResourceElements() {
- return AbstractJavaEntity.this.getSecondaryTableAnnotations();
- }
- @Override
- protected SecondaryTableAnnotation getResourceElement(JavaSecondaryTable contextElement) {
- return contextElement.getTableAnnotation();
- }
- }
-
- protected Table.Owner buildSpecifiedSecondaryTableOwner() {
- return new SecondaryTableOwner();
- }
-
-
- // ********** primary key join columns **********
-
- public ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
- }
-
- public int getPrimaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
- }
-
-
- // ********** specified primary key join columns **********
-
- public ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
- }
-
- protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumnsSize() != 0;
- }
-
- public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.getSpecifiedPrimaryKeyJoinColumnsSize());
- }
-
- public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- PrimaryKeyJoinColumnAnnotation annotation = this.addPrimaryKeyJoinColumnAnnotation(index);
- return this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(index, annotation);
- }
-
- protected PrimaryKeyJoinColumnAnnotation addPrimaryKeyJoinColumnAnnotation(int index) {
- return (PrimaryKeyJoinColumnAnnotation) this.getJavaResourceType().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumnContainer.indexOfContextElement((JavaPrimaryKeyJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- this.getJavaResourceType().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
- this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(index);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.getJavaResourceType().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
- this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected void syncSpecifiedPrimaryKeyJoinColumns() {
- this.specifiedPrimaryKeyJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedPrimaryKeyJoinColumns() {
- this.specifiedPrimaryKeyJoinColumnContainer.update();
- }
-
- protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
- return getPrimaryKeyJoinColumnAnnotations_();
- }
-
- protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations_() {
- return new SubListIterableWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>(this.getNestablePrimaryKeyJoinColumnAnnotations_());
- }
-
- protected ListIterable<NestableAnnotation> getNestablePrimaryKeyJoinColumnAnnotations_() {
- return this.getResourceAnnotatedElement().getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- protected PrimaryKeyJoinColumnOwner buildPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- protected JavaPrimaryKeyJoinColumn buildSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnAnnotation) {
- return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, primaryKeyJoinColumnAnnotation);
- }
-
- protected ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation> buildSpecifiedPrimaryKeyJoinColumnContainer() {
- return new SpecifiedPrimaryKeyJoinColumnContainer();
- }
-
- /**
- * specified primary key join column container
- */
- protected class SpecifiedPrimaryKeyJoinColumnContainer
- extends ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaPrimaryKeyJoinColumn buildContextElement(PrimaryKeyJoinColumnAnnotation resourceElement) {
- return AbstractJavaEntity.this.buildSpecifiedPrimaryKeyJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
- return AbstractJavaEntity.this.getPrimaryKeyJoinColumnAnnotations();
- }
- @Override
- protected PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
- return contextElement.getColumnAnnotation();
- }
- }
-
- // ********** 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 getDefaultPrimaryKeyJoinColumnsSize() {
- 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.buildSpecifiedPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.getJavaResourceType()));
- }
-
-
- // ********** 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.getJavaResourceType().getNonNullAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeInheritanceAnnotationIfUnset() {
- if (this.getInheritanceAnnotation().isUnset()) {
- this.removeInheritanceAnnotation();
- }
- }
-
- protected void removeInheritanceAnnotation() {
- this.getJavaResourceType().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.getJavaResourceType().getNonNullAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeDiscriminatorValueAnnotationIfUnset() {
- if (this.getDiscriminatorValueAnnotation().isUnset()) {
- this.removeDiscriminatorValueAnnotation();
- }
- }
-
- protected void removeDiscriminatorValueAnnotation() {
- this.getJavaResourceType().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 JavaResourceType getResourceAnnotatedElement() {
- return this.getJavaResourceType();
- }
-
-
- // ********** query container **********
-
- public JavaQueryContainer getQueryContainer() {
- return this.queryContainer;
- }
-
- protected JavaQueryContainer buildQueryContainer() {
- return this.getJpaFactory().buildJavaQueryContainer(this, this);
- }
-
-
- // ********** associated tables **********
-
- @Override
- public Iterable<ReadOnlyTable> getAssociatedTables() {
- return new CompositeIterable<ReadOnlyTable>(this.table, this.getSecondaryTables());
- }
-
-
- @Override
- public Iterable<ReadOnlyTable> getAllAssociatedTables() {
- return new CompositeIterable<ReadOnlyTable>(this.allAssociatedTablesLists());
- }
-
- // TODO eliminate duplicate tables?
- protected Iterable<Iterable<ReadOnlyTable>> allAssociatedTablesLists() {
- return new TransformationIterable<TypeMapping, Iterable<ReadOnlyTable>>(this.getInheritanceHierarchy(), TypeMappingTools.ASSOCIATED_TABLES_TRANSFORMER);
- }
-
- @Override
- 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 || this.tableNameIsValid_(tableName);
- }
-
- protected boolean tableNameIsValid_(String tableName) {
- return this.connectionProfileIsActive() ?
- (this.resolveDbTable(tableName) != null) :
- CollectionTools.contains(this.getAllAssociatedTableNames(), tableName);
- }
-
-
- // ********** database **********
-
- @Override
- public String getPrimaryTableName() {
- return this.table.getName();
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() {
- return this.table.getDbTable();
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- // matching database objects and identifiers is database platform-specific
- return this.getDataSource().selectTableForIdentifier(this.getAllAssociatedDbTables(), tableName);
- }
-
- /**
- * strip out null db tables
- */
- protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables() {
- return new FilteringIterable<org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedDbTables_(), NotNullFilter.<org.eclipse.jpt.jpa.db.Table>instance());
- }
-
- protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables_() {
- return new TransformationIterable<ReadOnlyTable, org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedTables()) {
- @Override
- protected org.eclipse.jpt.jpa.db.Table transform(ReadOnlyTable entityTable) {
- return entityTable.getDbTable();
- }
- };
- }
-
- @Override
- public Schema getDbSchema() {
- return this.table.getDbSchema();
- }
-
-
- // ********** primary key **********
-
- public String getPrimaryKeyColumnName() {
- return MappingTools.getPrimaryKeyColumnName(this);
- }
-
- public PersistentAttribute getIdAttribute() {
- Iterator<AttributeMapping> idAttributeMappings = this.getAllAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY).iterator();
- if (idAttributeMappings.hasNext()) {
- PersistentAttribute attribute = idAttributeMappings.next().getPersistentAttribute();
- return idAttributeMappings.hasNext() ? null /*more than one*/: attribute;
- }
- return null;
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- public boolean isMapped() {
- return true;
- }
-
- @Override
- public JavaResourceType getJavaResourceType() {
- return super.getJavaResourceType();
- }
-
-
- // ********** 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 Iterable<String> getOverridableAttributeNames() {
- return this.isTablePerClass() ?
- super.getOverridableAttributeNames() :
- EmptyIterable.<String>instance();
- }
-
- @Override
- public Iterable<String> getOverridableAssociationNames() {
- return this.isTablePerClass() ?
- super.getOverridableAssociationNames() :
- EmptyIterable.<String>instance();
- }
-
- public AttributeMapping resolveAttributeMapping(String name) {
- for (AttributeMapping attributeMapping : this.getAllAttributeMappings()) {
- 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.getJavaResourceType().isAbstract();
- }
-
- /**
- * Return whether the entity's type is final.
- */
- protected boolean isFinal() {
- return this.getJavaResourceType().isFinal();
- }
-
- /**
- * Return whether the entity's type is a member of another type.
- */
- protected boolean isMember() {
- return this.getJavaResourceType().isMemberType();
- }
-
- /**
- * Return whether the entity's type is static.
- */
- protected boolean isStatic() {
- return this.getJavaResourceType().isStatic();
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.table.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaSecondaryTable secondaryTable : this.getSecondaryTables()) {
- result = secondaryTable.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- for (JavaPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
- result = pkJoinColumn.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- result = this.attributeOverrideContainer.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.associationOverrideContainer.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.discriminatorColumn.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.generatorContainer.getJavaCompletionProposals(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, astRoot);
- this.idClassReference.validate(messages, reporter, astRoot);
- }
-
- @Override
- public boolean validatesAgainstDatabase() {
- return super.validatesAgainstDatabase() && ! this.isAbstractTablePerClass();
- }
-
- protected void validateEntityName(List<IMessage> messages, 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 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() && this.getDataSource().connectionProfileIsActive()) {
- if (this.specifiedTableDoesNotMatchRootTable()) {
- 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);
- }
-
- /**
- * Return whether the entity specifies a table and it is a different table
- * than the root entity's table.
- */
- protected boolean specifiedTableDoesNotMatchRootTable() {
- return this.table.isSpecifiedInResource() &&
- (this.table.getDbTable() != this.getRootEntity().getTable().getDbTable());
- }
-
- 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.getValidationTextRange(this.getDiscriminatorValueAnnotation().getTextRange(astRoot), astRoot);
- }
-
- protected TextRange getDiscriminatorColumnTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.discriminatorColumn.getValidationTextRange(astRoot), astRoot);
- }
-
- protected TextRange getInheritanceStrategyTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.getInheritanceAnnotation().getStrategyTextRange(astRoot), astRoot);
- }
-
-
- // ********** OrmOverrideContainer.Owner implementation **********
-
- /**
- * some common behavior
- */
- protected abstract class OverrideContainerOwner
- implements JavaOverrideContainer2_0.Owner
- {
- public JavaResourceMember getResourceMember() {
- return AbstractJavaEntity.this.getJavaResourceType();
- }
-
- public AbstractJavaEntity getTypeMapping() {
- return AbstractJavaEntity.this;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return AbstractJavaEntity.this.getValidationTextRange(astRoot);
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return AbstractJavaEntity.this.getOverridableTypeMapping();
- }
-
- public Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? this.getAllOverridableNames_(overriddenTypeMapping) : EmptyIterable.<String>instance();
- }
-
- /**
- * pre-condition: <code>typeMapping</code> is not <code>null</code>
- */
- protected abstract Iterable<String> getAllOverridableNames_(TypeMapping overriddenTypeMapping);
-
- public String getDefaultTableName() {
- return AbstractJavaEntity.this.getPrimaryTableName();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return AbstractJavaEntity.this.tableNameIsInvalid(tableName);
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return AbstractJavaEntity.this.resolveDbTable(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return AbstractJavaEntity.this.getAllAssociatedTableNames();
- }
-
- 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 JavaAttributeOverrideContainer2_0.Owner
- {
- @Override
- protected Iterable<String> getAllOverridableNames_(TypeMapping overriddenTypeMapping) {
- return new FilteringIterable<String>(overriddenTypeMapping.getAllOverridableAttributeNames()) {
- @Override
- protected boolean accept(String attributeName) {
- return ! AttributeOverrideContainerOwner.this.getTypeMapping().attributeIsDerivedId(attributeName);
- }
- };
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AttributeOverrideValidator((ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AttributeOverrideColumnValidator((ReadOnlyAttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
- }
- }
-
-
- // ********** JavaAssociationOverrideContainer.Owner implementation **********
-
- protected class AssociationOverrideContainerOwner
- extends OverrideContainerOwner
- implements JavaAssociationOverrideContainer2_0.Owner
- {
- @Override
- protected Iterable<String> getAllOverridableNames_(TypeMapping overriddenTypeMapping) {
- return overriddenTypeMapping.getAllOverridableAssociationNames();
- }
-
- public Relationship resolveOverriddenRelationship(String attributeName) {
- return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AssociationOverrideValidator((ReadOnlyAssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator((ReadOnlyAssociationOverride) override, (ReadOnlyJoinColumn) column, (ReadOnlyJoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable t, TableTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinTableValidator(override, (ReadOnlyJoinTable) t, textRangeResolver);
- }
- }
-
-
- // ********** JavaNamedColumn.Owner implementation **********
-
- /**
- * some common behavior
- */
- protected abstract class NamedColumnOwner
- implements JavaReadOnlyNamedColumn.Owner
- {
- public TypeMapping getTypeMapping() {
- return AbstractJavaEntity.this;
- }
-
- public String getDefaultTableName() {
- return AbstractJavaEntity.this.getPrimaryTableName();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return AbstractJavaEntity.this.resolveDbTable(tableName);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return AbstractJavaEntity.this.getValidationTextRange(astRoot);
- }
- }
-
-
- // ********** JavaBaseJoinColumn.Owner implementation **********
-
- protected class PrimaryKeyJoinColumnOwner
- extends NamedColumnOwner
- implements JavaReadOnlyBaseJoinColumn.Owner
- {
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- Entity parentEntity = AbstractJavaEntity.this.getParentEntity();
- return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
- }
-
- public int getJoinColumnsSize() {
- return AbstractJavaEntity.this.getPrimaryKeyJoinColumnsSize();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return AbstractJavaEntity.this.defaultPrimaryKeyJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- if (this.getJoinColumnsSize() != 1) {
- return null;
- }
- Entity parentEntity = AbstractJavaEntity.this.getParentEntity();
- return (parentEntity == null) ? AbstractJavaEntity.this.getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new EntityPrimaryKeyJoinColumnValidator((ReadOnlyBaseJoinColumn) 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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new DiscriminatorColumnValidator(column, textRangeResolver);
- }
- }
-
-
- // ********** table owner **********
-
- protected class TableOwner
- implements ReadOnlyTable.Owner
- {
- public JptValidator buildTableValidator(ReadOnlyTable t, TableTextRangeResolver textRangeResolver) {
- return new TableValidator(t, textRangeResolver);
- }
- }
-
-
- // ********** secondary table owner **********
-
- protected class SecondaryTableOwner
- implements ReadOnlyTable.Owner
- {
- public JptValidator buildTableValidator(ReadOnlyTable t, TableTextRangeResolver textRangeResolver) {
- return new SecondaryTableValidator((ReadOnlySecondaryTable) t, textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java
deleted file mode 100644
index 51ed36d6b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java
+++ /dev/null
@@ -1,248 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.context.Generator;
-import org.eclipse.jpt.jpa.core.context.java.JavaGenerator;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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());
- }
-
-
- // ********** 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;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-
- if (StringTools.stringIsEmpty(this.name)){
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.GENERATOR_NAME_UNDEFINED,
- EMPTY_STRING_ARRAY,
- this,
- this.getNameTextRange(astRoot)
- )
- );
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.generatorAnnotation.getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.generatorAnnotation.getNameTextRange(astRoot), 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 **********
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
- public A getGeneratorAnnotation() {
- return this.generatorAnnotation;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java
deleted file mode 100644
index 4aeb7d87a4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java
+++ /dev/null
@@ -1,479 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.Association;
-import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.IdMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-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
-
- /* JPA 2.0 - the embedded id may be derived from a relationship */
- protected boolean derived;
-
-
- 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.setDerived(this.buildDerived());
- }
-
-
- // ********** column **********
-
- public JavaColumn getColumn() {
- return this.column;
- }
-
- protected JavaColumn buildColumn() {
- return this.getJpaFactory().buildJavaColumn(this, this);
- }
-
-
- // ********** generator container **********
-
- public JavaGeneratorContainer getGeneratorContainer() {
- return this.generatorContainer;
- }
-
- protected 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.getResourceAttribute().addAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME);
- }
-
- public void removeGeneratedValue() {
- if (this.generatedValue == null) {
- throw new IllegalStateException("generated value does not exist"); //$NON-NLS-1$
- }
- this.getResourceAttribute().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.getResourceAttribute().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) {
- JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
- 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() {
- JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
- 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;
- }
-
-
- // ********** derived **********
-
- public boolean isDerived() {
- return this.derived;
- }
-
- protected void setDerived(boolean derived) {
- boolean old = this.derived;
- this.derived = derived;
- this.firePropertyChanged(DERIVED_PROPERTY, old, derived);
- }
-
- protected boolean buildDerived() {
- return this.isJpa2_0Compatible() && this.buildDerived_();
- }
-
- protected boolean buildDerived_() {
- return this.getTypeMapping().attributeIsDerivedId(this.getName());
- }
-
-
- // ********** 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.getResourceAttribute().getAnnotation(ColumnAnnotation.ANNOTATION_NAME) != null;
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
-
- // ********** JavaGeneratorContainer implementation **********
-
- public JavaResourceMember getResourceAnnotatedElement() {
- return this.getResourceAttribute();
- }
-
-
- // ********** JavaColumn.Owner implementation **********
-
- public ColumnAnnotation getColumnAnnotation() {
- return (ColumnAnnotation) this.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
- }
-
- public void removeColumnAnnotation() {
- this.getResourceAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME);
- }
-
- public String getDefaultColumnName() {
- return (this.derived && ! this.columnIsSpecified()) ? null : this.getName();
- }
-
- public String getDefaultTableName() {
- return (this.derived && ! this.columnIsSpecified()) ? null : this.getTypeMapping().getPrimaryTableName();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.column.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.generatorContainer.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- if (this.generatedValue != null) {
- result = this.generatedValue.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
-
- result = this.converter.getJavaCompletionProposals(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,
- // the column is validated.
- // JPA 1.0: The column is always be validated, since the ID is never mapped by a
- // relationship.
- if (this.columnIsSpecified() || ! this.derived) {
- this.column.validate(messages, reporter, astRoot);
- }
-
- // JPA 2.0: If the column is specified and the ID is mapped by a relationship,
- // we have an error.
- // JPA 1.0: The ID cannot be mapped by a relationship.
- if (this.columnIsSpecified() && this.derived) {
- messages.add(this.buildColumnSpecifiedAndDerivedMessage(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 buildColumnSpecifiedAndDerivedMessage(CompilationUnit astRoot) {
- return this.buildMessage(
- JpaValidationMessages.ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED,
- EMPTY_STRING_ARRAY,
- this.column.getValidationTextRange(astRoot)
- );
- }
-
- 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;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 6f63acc7c9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,307 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaJoinColumnRelationshipStrategy
- extends AbstractJavaJpaContextNode
- implements JavaJoinColumnRelationshipStrategy
-{
- protected final ContextListContainer<JavaJoinColumn, JoinColumnAnnotation> specifiedJoinColumnContainer;
- protected final JavaReadOnlyJoinColumn.Owner joinColumnOwner;
-
- protected JavaJoinColumn defaultJoinColumn;
-
-
- protected AbstractJavaJoinColumnRelationshipStrategy(JavaJoinColumnRelationship parent) {
- super(parent);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
- }
-
-
- // ********** 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 ListIterable<JavaJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int getJoinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
- return this.specifiedJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- return this.specifiedJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.getSpecifiedJoinColumnsSize() != 0;
- }
-
- public JavaJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumnContainer.getContextElement(index);
- }
-
- public JavaJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.getSpecifiedJoinColumnsSize());
- }
-
- public JavaJoinColumn addSpecifiedJoinColumn(int index) {
- JoinColumnAnnotation annotation = this.addJoinColumnAnnotation(index);
- return this.specifiedJoinColumnContainer.addContextElement(index, annotation);
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumnContainer.indexOfContextElement((JavaJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- this.removeJoinColumnAnnotation(index);
- this.specifiedJoinColumnContainer.removeContextElement(index);
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- this.moveJoinColumnAnnotation(targetIndex, sourceIndex);
- this.specifiedJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected void syncSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.update();
- }
-
- protected ContextListContainer<JavaJoinColumn, JoinColumnAnnotation> buildSpecifiedJoinColumnContainer() {
- return new SpecifiedJoinColumnContainer();
- }
-
- /**
- * specified join column container
- */
- protected class SpecifiedJoinColumnContainer
- extends ContextListContainer<JavaJoinColumn, JoinColumnAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaJoinColumn buildContextElement(JoinColumnAnnotation resourceElement) {
- return AbstractJavaJoinColumnRelationshipStrategy.this.buildJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<JoinColumnAnnotation> getResourceElements() {
- return AbstractJavaJoinColumnRelationshipStrategy.this.getJoinColumnAnnotations();
- }
- @Override
- protected JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
- return contextElement.getColumnAnnotation();
- }
- }
-
- protected abstract JavaReadOnlyJoinColumn.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 ListIterable<JoinColumnAnnotation> getJoinColumnAnnotations();
-
- 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 : oldStrategy.getSpecifiedJoinColumns()) {
- this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
- }
- }
-
- public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy virtualStrategy) {
- for (ReadOnlyJoinColumn joinColumn : virtualStrategy.getJoinColumns()) {
- 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 Iterable<String> getCandidateTableNames() {
- TypeMapping typeMapping = this.getRelationshipSource();
- return (typeMapping != null) ? typeMapping.getAllAssociatedTableNames() : EmptyIterable.<String>instance();
- }
-
- public void addStrategy() {
- if (this.getSpecifiedJoinColumnsSize() == 0) {
- this.addSpecifiedJoinColumn();
- }
- }
-
- public void removeStrategy() {
- for (int i = this.getSpecifiedJoinColumnsSize(); i-- > 0; ) {
- this.removeSpecifiedJoinColumn(i);
- }
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaJoinColumn joinColumn : this.getJoinColumns()) {
- result = joinColumn.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- for (JavaJoinColumn joinColumn : this.getJoinColumns()) {
- joinColumn.validate(messages, reporter, astRoot);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java
deleted file mode 100644
index 2b5f2622d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,195 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaJoinTableRelationshipStrategy
- extends AbstractJavaJpaContextNode
- implements JavaJoinTableRelationshipStrategy, ReadOnlyTable.Owner
-{
- protected JavaJoinTable joinTable;
-
-
- protected AbstractJavaJoinTableRelationshipStrategy(JavaJoinTableRelationship parent) {
- super(parent);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- if (this.joinTable != null) {
- this.joinTable.synchronizeWithResourceModel();
- }
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJoinTable();
- }
-
-
- // ********** join table **********
-
- public JavaJoinTable getJoinTable() {
- return this.joinTable;
- }
-
- protected void setJoinTable(JavaJoinTable joinTable) {
- JavaJoinTable old = this.joinTable;
- this.joinTable = joinTable;
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable);
- }
-
- protected void updateJoinTable() {
- if (this.buildsJoinTable()) {
- if (this.joinTable == null) {
- this.setJoinTable(this.buildJoinTable());
- } else {
- this.joinTable.update();
- }
- } else {
- if (this.joinTable != null) {
- this.setJoinTable(null);
- }
- }
- }
-
- /**
- * The strategy can have a join table if either the table annotation is present
- * or the [mapping] relationship supports a default join table.
- */
- protected boolean buildsJoinTable() {
- return this.getJoinTableAnnotation().isSpecified()
- || this.getRelationship().mayHaveDefaultJoinTable();
- }
-
- protected JavaJoinTable buildJoinTable() {
- return this.getJpaFactory().buildJavaJoinTable(this, this);
- }
-
-
- // ********** join table annotation **********
-
- protected abstract JoinTableAnnotation addJoinTableAnnotation();
-
- protected abstract void removeJoinTableAnnotation();
-
-
- // ********** misc **********
-
- @Override
- public JavaJoinTableRelationship getParent() {
- return (JavaJoinTableRelationship) super.getParent();
- }
-
- public JavaJoinTableRelationship getRelationship() {
- return this.getParent();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getRelationship().getMapping();
- }
-
- public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) {
- ReadOnlyJoinTable oldJoinTable = oldStrategy.getJoinTable();
- if (oldJoinTable != null) {
- this.addStrategy();
- this.joinTable.initializeFrom(oldJoinTable);
- }
- }
-
- public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) {
- ReadOnlyJoinTable oldJoinTable = virtualStrategy.getJoinTable();
- if (oldJoinTable != null) {
- this.addStrategy();
- this.joinTable.initializeFromVirtual(oldJoinTable);
- }
- }
-
- public String getTableName() {
- return (this.joinTable == null) ? null : this.joinTable.getName();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return (this.joinTable == null) ? null : this.joinTable.getDbTable();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return Tools.valuesAreDifferent(this.getTableName(), tableName);
- }
-
- public String getColumnTableNotValidDescription() {
- return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE;
- }
-
- public String getJoinTableDefaultName() {
- return MappingTools.buildJoinTableDefaultName(this.getRelationship());
- }
-
- public void addStrategy() {
- if (this.joinTable == null) {
- this.addJoinTableAnnotation();
- this.setJoinTable(this.buildJoinTable());
- }
- }
-
- public void removeStrategy() {
- if (this.joinTable != null) {
- this.removeJoinTableAnnotation();
- this.setJoinTable(null);
- }
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.joinTable != null) {
- result = this.joinTable.getJavaCompletionProposals(pos, filter, astRoot);
- }
- return result;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- if (this.joinTable != null) {
- this.joinTable.validate(messages, reporter, astRoot);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java
deleted file mode 100644
index 965f34f8f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java
+++ /dev/null
@@ -1,97 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaJpaContextNode
- extends AbstractJpaContextNode
- implements JavaJpaContextNode
-{
- protected AbstractJavaJpaContextNode(JpaContextNode parent) {
- super(parent);
- }
-
- @Override
- public JptResourceType getResourceType() {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
-
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- if (this.connectionProfileIsActive()) {
- Iterable<String> result = this.getConnectedJavaCompletionProposals(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 <em>not</em> be cascaded to "child" objects; it should
- * only return candidates for the current object. The cascading is
- * handled by {@link #getJavaCompletionProposals(int, Filter, CompilationUnit)}.
- */
- @SuppressWarnings("unused")
- protected Iterable<String> getConnectedJavaCompletionProposals(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();
- }
- }
-
- /**
- * Validate the specified node if it is not <code>null</code>.
- */
- protected void validateNode(JavaJpaContextNode node, List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- if (node != null) {
- node.validate(messages, reporter, astRoot);
- }
- }
-
- /**
- * Validate the specified nodes.
- */
- protected void validateNodes(Iterable<? extends JavaJpaContextNode> nodes, List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- for (JavaJpaContextNode node : nodes) {
- node.validate(messages, reporter, astRoot);
- }
- }
-
- /**
- * Return the specified text range if it is not <code>null</code>; if it is
- * <code>null</code>, return the node's validation text range.
- */
- protected TextRange getValidationTextRange(TextRange textRange, CompilationUnit astRoot) {
- return (textRange != null) ? textRange : this.getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java
deleted file mode 100644
index 22c5d8c9e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToManyMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
-
-public abstract class AbstractJavaManyToManyMapping
- extends AbstractJavaMultiRelationshipMapping<ManyToManyAnnotation>
- implements JavaManyToManyMapping2_0
-{
- protected AbstractJavaManyToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-
- // ********** relationship **********
-
- @Override
- public JavaManyToManyRelationship getRelationship() {
- return (JavaManyToManyRelationship) super.getRelationship();
- }
-
- @Override
- protected JavaMappingRelationship buildRelationship() {
- return new GenericJavaManyToManyRelationship(this);
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected String getAnnotationName() {
- return ManyToManyAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java
deleted file mode 100644
index 42a93b9b37..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToOneMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
-
-public abstract class AbstractJavaManyToOneMapping
- extends AbstractJavaSingleRelationshipMapping<ManyToOneAnnotation>
- implements JavaManyToOneMapping2_0
-{
- protected AbstractJavaManyToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-
- // ********** relationship **********
-
- @Override
- public JavaManyToOneRelationship getRelationship() {
- return (JavaManyToOneRelationship) super.getRelationship();
- }
-
- @Override
- protected JavaManyToOneRelationship buildRelationship() {
- return new GenericJavaManyToOneRelationship(this);
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected String getAnnotationName() {
- return ManyToOneAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java
deleted file mode 100644
index d51f3017e1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java
+++ /dev/null
@@ -1,113 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericMappedSuperclassPrimaryKeyValidator;
-import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java mapped superclass
- */
-public abstract class AbstractJavaMappedSuperclass
- extends AbstractJavaTypeMapping<MappedSuperclassAnnotation>
- implements JavaMappedSuperclass
-{
- protected final JavaIdClassReference idClassReference;
-
-
- protected AbstractJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappingAnnotation) {
- super(parent, mappingAnnotation);
- this.idClassReference = this.buildIdClassReference();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.idClassReference.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.idClassReference.update();
- }
-
-
- // ********** id class **********
-
- public JavaIdClassReference getIdClassReference() {
- return this.idClassReference;
- }
-
- protected JavaIdClassReference buildIdClassReference() {
- return new GenericJavaIdClassReference(this);
- }
-
- public JavaPersistentType getIdClass() {
- return this.idClassReference.getIdClass();
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- public boolean isMapped() {
- return true;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validatePrimaryKey(messages, reporter, astRoot);
- this.idClassReference.validate(messages, reporter, astRoot);
- }
-
- @Override
- public boolean validatesAgainstDatabase() {
- return false;
- }
-
- protected void validatePrimaryKey(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- this.buildPrimaryKeyValidator(astRoot).validate(messages, reporter);
- }
-
- protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) {
- return new GenericMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot));
- // TODO - JPA 2.0 validation
- }
-
- @Override
- protected PrimaryKeyTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
- return new JavaMappedSuperclassTextRangeResolver(this, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java
deleted file mode 100644
index 629387495a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingRelationshipStrategy2_0;
-
-/**
- * <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 JavaMappingRelationshipStrategy2_0 strategy;
-
-
- public AbstractJavaMappingRelationship(M parent) {
- super(parent);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateStrategy();
- }
-
-
- // ********** strategy **********
-
- public JavaMappingRelationshipStrategy2_0 getStrategy() {
- return this.strategy;
- }
-
- protected void setStrategy(JavaMappingRelationshipStrategy2_0 strategy) {
- RelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- protected abstract JavaMappingRelationshipStrategy2_0 buildStrategy();
-
- /**
- * This is called by subclasses when the various supported strategies are
- * added or removed; allowing the strategy to be set synchronously. (?)
- */
- protected void updateStrategy() {
- this.setStrategy(this.buildStrategy());
- }
-
-
- // ********** conversions **********
-
- public void initializeFrom(ReadOnlyRelationship oldRelationship) {
- oldRelationship.initializeOn(this);
- }
-
- public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
- // NOP
- }
-
- public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
- // NOP
- }
-
- public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
- // NOP
- }
-
-
- // ********** misc **********
-
- @Override
- @SuppressWarnings("unchecked")
- public M getParent() {
- return (M) super.getParent();
- }
-
- public JavaRelationshipMapping getMapping() {
- return this.getParent();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getMapping().getTypeMapping();
- }
-
- public Entity getEntity() {
- TypeMapping typeMapping = this.getTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- public boolean isOverridable() {
- return this.strategy.isOverridable();
- }
-
- public boolean isVirtual() {
- return this.getMapping().getPersistentAttribute().isVirtual();
- }
-
- public boolean isTargetForeignKey() {
- return false;
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getMapping().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
deleted file mode 100644
index e0c2467a91..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
+++ /dev/null
@@ -1,784 +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.jpa.core.internal.context.java;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaMapKeyColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java multi-relationship (m:m, 1:m) mapping
- */
-public abstract class AbstractJavaMultiRelationshipMapping<A extends RelationshipMappingAnnotation>
- extends AbstractJavaRelationshipMapping<A>
- implements JavaMultiRelationshipMapping, JavaCollectionMapping2_0
-{
- protected final JavaOrderable orderable;
-
- protected String specifiedMapKey;
- protected boolean noMapKey = false;
- protected boolean pkMapKey = false;
- protected boolean customMapKey = false;
-
- protected String specifiedMapKeyClass;
- protected String defaultMapKeyClass;
- protected String fullyQualifiedMapKeyClass;
-
- protected Type valueType;
- protected Type keyType;
-
- protected final JavaColumn mapKeyColumn;
-
- protected final JavaAttributeOverrideContainer mapKeyAttributeOverrideContainer;
-
-
- protected AbstractJavaMultiRelationshipMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.orderable = this.buildOrderable();
-
- this.specifiedMapKey = this.buildSpecifiedMapKey();
- this.noMapKey = this.buildNoMapKey();
- this.pkMapKey = this.buildPkMapKey();
- this.customMapKey = this.buildCustomMapKey();
-
- this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass();
-
- this.mapKeyColumn = this.buildMapKeyColumn();
- this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.orderable.synchronizeWithResourceModel();
-
- this.setSpecifiedMapKey_(this.buildSpecifiedMapKey());
- this.setNoMapKey_(this.buildNoMapKey());
- this.setPkMapKey_(this.buildPkMapKey());
- this.setCustomMapKey_(this.buildCustomMapKey());
-
- this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass());
-
- this.mapKeyColumn.synchronizeWithResourceModel();
-
- this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
-
- this.orderable.update();
-
- this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
- this.setFullyQualifiedMapKeyClass(this.buildFullyQualifiedMapKeyClass());
-
- this.setValueType(this.buildValueType());
- this.setKeyType(this.buildKeyType());
-
- this.mapKeyColumn.update();
-
- this.mapKeyAttributeOverrideContainer.update();
- }
-
-
- // ********** orderable **********
-
- public JavaOrderable getOrderable() {
- return this.orderable;
- }
-
- protected JavaOrderable buildOrderable() {
- return this.isJpa2_0Compatible() ?
- this.getJpaFactory2_0().buildJavaOrderable(this, this.buildOrderableOwner()) :
- this.getJpaFactory().buildJavaOrderable(this);
- }
-
- protected Orderable2_0.Owner buildOrderableOwner() {
- return new OrderableOwner();
- }
-
- protected class OrderableOwner
- implements Orderable2_0.Owner
- {
- public String getTableName() {
- return this.getRelationshipStrategy().getTableName();
- }
- public Table resolveDbTable(String tableName) {
- return this.getRelationshipStrategy().resolveDbTable(tableName);
- }
- protected JavaRelationshipStrategy getRelationshipStrategy() {
- return AbstractJavaMultiRelationshipMapping.this.getRelationship().getStrategy();
- }
- }
-
-
- // ********** map key **********
-
- public String getMapKey() {
- if (this.noMapKey) {
- return null;
- }
- if (this.pkMapKey) {
- return this.getTargetEntityIdAttributeName();
- }
- if (this.customMapKey) {
- return this.specifiedMapKey;
- }
- throw new IllegalStateException("unknown map key"); //$NON-NLS-1$
- }
-
-
- // ********** specified map key **********
-
- public String getSpecifiedMapKey() {
- return this.specifiedMapKey;
- }
-
- public void setSpecifiedMapKey(String mapKey) {
- if (mapKey != null) {
- this.getMapKeyAnnotationForUpdate().setName(mapKey);
-
- this.setSpecifiedMapKey_(mapKey);
- this.setNoMapKey_(false);
- this.setPkMapKey_(false);
- this.setCustomMapKey_(true);
- } else {
- this.setPkMapKey(true); // hmmm...
- }
- }
-
- protected void setSpecifiedMapKey_(String mapKey) {
- String old = this.specifiedMapKey;
- this.specifiedMapKey = mapKey;
- this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey);
- }
-
- protected String buildSpecifiedMapKey() {
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- return (mapKeyAnnotation == null) ? null : mapKeyAnnotation.getName();
- }
-
-
- // ********** no map key **********
-
- public boolean isNoMapKey() {
- return this.noMapKey;
- }
-
- public void setNoMapKey(boolean noMapKey) {
- if (noMapKey) {
- if (this.getMapKeyAnnotation() != null) {
- this.removeMapKeyAnnotation();
- }
-
- this.setSpecifiedMapKey_(null);
- this.setNoMapKey_(true);
- this.setPkMapKey_(false);
- this.setCustomMapKey_(false);
- } else {
- this.setPkMapKey(true); // hmmm...
- }
- }
-
- protected void setNoMapKey_(boolean noMapKey) {
- boolean old = this.noMapKey;
- this.noMapKey = noMapKey;
- this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey);
- }
-
- protected boolean buildNoMapKey() {
- return this.getMapKeyAnnotation() == null;
- }
-
-
- // ********** pk map key **********
-
- public boolean isPkMapKey() {
- return this.pkMapKey;
- }
-
- public void setPkMapKey(boolean pkMapKey) {
- if (pkMapKey) {
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- if (mapKeyAnnotation == null) {
- mapKeyAnnotation = this.addMapKeyAnnotation();
- } else {
- mapKeyAnnotation.setName(null);
- }
-
- this.setSpecifiedMapKey_(null);
- this.setNoMapKey_(false);
- this.setPkMapKey_(true);
- this.setCustomMapKey_(false);
- } else {
- this.setNoMapKey(true); // hmmm...
- }
- }
-
- protected void setPkMapKey_(boolean pkMapKey) {
- boolean old = this.pkMapKey;
- this.pkMapKey = pkMapKey;
- this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey);
- }
-
- protected boolean buildPkMapKey() {
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() == null);
- }
-
-
- // ********** custom map key **********
-
- public boolean isCustomMapKey() {
- return this.customMapKey;
- }
-
- public void setCustomMapKey(boolean customMapKey) {
- if (customMapKey) {
- this.setSpecifiedMapKey(""); //$NON-NLS-1$
- } else {
- this.setNoMapKey(true); // hmmm...
- }
- }
-
- protected void setCustomMapKey_(boolean customMapKey) {
- boolean old = this.customMapKey;
- this.customMapKey = customMapKey;
- this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey);
- }
-
- protected boolean buildCustomMapKey() {
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() != null);
- }
-
-
- // ********** map key annotation **********
-
- protected MapKeyAnnotation getMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourceAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- }
-
- protected MapKeyAnnotation getMapKeyAnnotationForUpdate() {
- MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation();
- return (mapKeyAnnotation != null) ? mapKeyAnnotation : this.addMapKeyAnnotation();
- }
-
- protected MapKeyAnnotation addMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourceAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeMapKeyAnnotation() {
- this.getResourceAttribute().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.getResourceAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
- }
-
- protected MapKeyClass2_0Annotation addMapKeyClassAnnotation() {
- return (MapKeyClass2_0Annotation) this.getResourceAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
- }
-
- protected void removeMapKeyClassAnnotation() {
- this.getResourceAttribute().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.getResourceAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
- }
-
- protected void removeMapKeyColumnAnnotation() {
- if (this.isJpa2_0Compatible()) {
- this.removeMapKeyColumnAnnotation_();
- } else {
- throw new IllegalStateException();
- }
- }
-
- protected void removeMapKeyColumnAnnotation_() {
- this.getResourceAttribute().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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.orderable.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- if (this.mapKeyNameTouches(pos, astRoot)) {
- return this.javaCandidateMapKeyNames(filter);
- }
-
- result = this.mapKeyColumn.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.mapKeyAttributeOverrideContainer.getJavaCompletionProposals(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 Iterable<String> javaCandidateMapKeyNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateMapKeyNames(filter));
- }
-
- protected Iterable<String> getCandidateMapKeyNames(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateMapKeyNames(), filter);
- }
-
- public Iterable<String> getCandidateMapKeyNames() {
- return this.getAllTargetEntityAttributeNames();
- }
-
-
- // ********** 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 Iterable<String> getCandidateTableNames() {
- return EmptyIterable.instance();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return AbstractJavaMultiRelationshipMapping.this.getValidationTextRange(astRoot);
- }
-
- protected RelationshipStrategy getRelationshipStrategy() {
- return AbstractJavaMultiRelationshipMapping.this.getRelationship().getStrategy();
- }
-
- protected JavaPersistentAttribute getPersistentAttribute() {
- return AbstractJavaMultiRelationshipMapping.this.getPersistentAttribute();
- }
- }
-
-
- // ********** 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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new MapKeyColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy()));
- }
- }
-
-
- // ********** map key attribute override owner **********
-
- protected class MapKeyAttributeOverrideContainerOwner
- extends AbstractOwner
- implements JavaAttributeOverrideContainer2_0.Owner
- {
- public JavaResourceAttribute getResourceMember() {
- return AbstractJavaMultiRelationshipMapping.this.getResourceAttribute();
- }
-
- 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 Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? overriddenTypeMapping.getAllOverridableAttributeNames() : EmptyIterable.<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 buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, column, textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy()));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java
deleted file mode 100644
index 9fe01f4fd0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java
+++ /dev/null
@@ -1,295 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java<ul>
- * <li>column
- * <li>join column
- * <li>discriminator column
- * <li>order column
- * <li>primary key join column
- * </ul>
- * <strong>NB:</strong> any subclass that directly holds its column annotation
- * must:<ul>
- * <li>call the "super" constructor that takes a column annotation
- * {@link #AbstractJavaNamedColumn(JavaJpaContextNode, JavaReadOnlyNamedColumn.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 JavaReadOnlyNamedColumn.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
- protected Iterable<String> getConnectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getConnectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.getJavaCandidateNames(filter);
- }
- 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.buildValidator(astRoot).validate(messages, reporter);
- }
-
- protected JptValidator buildValidator(CompilationUnit astRoot) {
- return this.owner.buildColumnValidator(this, 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) {
- return this.getValidationTextRange(this.getColumnAnnotation().getNameTextRange(astRoot), astRoot);
- }
-
-
- // ********** misc **********
-
- /**
- * This is used by the subclasses that implement {@link ReadOnlyBaseJoinColumn#isVirtual()}.
- */
- public boolean isVirtual() {
- return false;
- }
-
- protected void initializeFrom(ReadOnlyNamedColumn oldColumn) {
- this.setSpecifiedName(oldColumn.getSpecifiedName());
- this.setColumnDefinition(oldColumn.getColumnDefinition());
- }
-
- protected void initializeFromVirtual(ReadOnlyNamedColumn virtualColumn) {
- this.setSpecifiedName(virtualColumn.getName());
- this.setColumnDefinition(virtualColumn.getColumnDefinition());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- String table = this.getTable();
- if (table != null) {
- sb.append(table);
- sb.append('.');
- }
- sb.append(this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumnTextRangeResolver.java
deleted file mode 100644
index a8139f49d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumnTextRangeResolver.java
+++ /dev/null
@@ -1,34 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-
-public abstract class AbstractJavaNamedColumnTextRangeResolver<C extends JavaReadOnlyNamedColumn>
- implements NamedColumnTextRangeResolver
-{
- protected final C column;
-
- protected final CompilationUnit astRoot;
-
-
- protected AbstractJavaNamedColumnTextRangeResolver(C column, CompilationUnit astRoot) {
- super();
- this.column = column;
- this.astRoot = astRoot;
- }
-
- public TextRange getNameTextRange() {
- return this.column.getNameTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java
deleted file mode 100644
index a7614b8d84..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToManyMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
-
-public abstract class AbstractJavaOneToManyMapping
- extends AbstractJavaMultiRelationshipMapping<OneToManyAnnotation>
- implements JavaOneToManyMapping2_0, JavaOrphanRemovalHolder2_0
-{
- protected final JavaOrphanRemovable2_0 orphanRemoval;
-
-
- protected AbstractJavaOneToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.orphanRemoval = this.buildOrphanRemoval();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.orphanRemoval.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.orphanRemoval.update();
- }
-
-
- // ********** relationship **********
-
- @Override
- public JavaOneToManyRelationship getRelationship() {
- return (JavaOneToManyRelationship) super.getRelationship();
- }
-
- @Override
- protected JavaMappingRelationship buildRelationship() {
- return new GenericJavaOneToManyRelationship(this, this.isJpa2_0Compatible());
- }
-
-
- // ********** orphan removal **********
-
- public JavaOrphanRemovable2_0 getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- protected JavaOrphanRemovable2_0 buildOrphanRemoval() {
- return this.isJpa2_0Compatible() ?
- this.getJpaFactory2_0().buildJavaOrphanRemoval(this) :
- new NullJavaOrphanRemoval2_0(this);
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected String getAnnotationName() {
- return OneToManyAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java
deleted file mode 100644
index 1fca5e88aa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToOneMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
-
-
-public abstract class AbstractJavaOneToOneMapping
- extends AbstractJavaSingleRelationshipMapping<OneToOneAnnotation>
- implements JavaOneToOneMapping2_0, JavaOrphanRemovalHolder2_0
-{
- protected final JavaOrphanRemovable2_0 orphanRemoval;
-
-
- protected AbstractJavaOneToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.orphanRemoval = this.buildOrphanRemoval();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.orphanRemoval.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.orphanRemoval.update();
- }
-
-
- // ********** relationship **********
-
- @Override
- public JavaOneToOneRelationship getRelationship() {
- return (JavaOneToOneRelationship) super.getRelationship();
- }
-
- @Override
- protected JavaOneToOneRelationship buildRelationship() {
- return new GenericJavaOneToOneRelationship(this);
- }
-
-
- // ********** orphan removal **********
-
- public JavaOrphanRemovable2_0 getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- protected JavaOrphanRemovable2_0 buildOrphanRemoval() {
- return this.isJpa2_0Compatible() ?
- this.getJpaFactory2_0().buildJavaOrphanRemoval(this) :
- new NullJavaOrphanRemoval2_0(this);
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected String getAnnotationName() {
- return OneToOneAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java
deleted file mode 100644
index fa8f332a56..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java
+++ /dev/null
@@ -1,247 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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.isJpa2_0Compatible() ? this.getContainer2_0().getPossiblePrefix() : null;
- }
-
-
- // ********** 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();
- }
-
- protected C getContainer() {
- return this.getParent();
- }
-
- protected JavaOverrideContainer2_0 getContainer2_0() {
- return (JavaOverrideContainer2_0) this.getContainer();
- }
-
- 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()));
- }
-
- public TypeMapping getTypeMapping() {
- return this.getContainer().getTypeMapping();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getContainer().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getContainer().getDefaultTableName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyBaseColumn column, Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, column, owner, textRangeResolver);
- }
-
- 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.isJpa2_0Compatible() ? this.getContainer2_0().getWritePrefix() : null;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.getJavaCandidateNames(filter);
- }
- return null;
- }
-
- protected boolean nameTouches(int pos, CompilationUnit astRoot) {
- return this.overrideAnnotation.nameTouches(pos, astRoot);
- }
-
- protected Iterable<String> getJavaCandidateNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateNames(filter));
- }
-
- private Iterable<String> getCandidateNames(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateNames(), filter);
- }
-
- protected abstract Iterable<String> getCandidateNames();
-
-
- // ********** 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().buildOverrideValidator(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.getContainer().getValidationTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.overrideAnnotation.getNameTextRange(astRoot), astRoot);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getContainer().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getContainer().getCandidateTableNames();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
deleted file mode 100644
index cd439bddd0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
+++ /dev/null
@@ -1,819 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.internal.utility.JDTTools;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.ReflectionTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.CollectionMapping;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.Accessor;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaStructureNodes;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-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 Accessor accessor;
-
- protected AccessType defaultAccess;
- protected AccessType specifiedAccess;
-
- protected JavaAttributeMapping mapping; // never null
- protected String defaultMappingKey;
-
- protected AbstractJavaPersistentAttribute(PersistentType parent, JavaResourceField resourceField) {
- super(parent);
- this.accessor = new FieldAccessor(this, resourceField);
- this.initialize();
- }
-
- protected AbstractJavaPersistentAttribute(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
- super(parent);
- this.accessor = new PropertyAccessor(this, resourceGetter, resourceSetter);
- this.initialize();
- }
-
- protected AbstractJavaPersistentAttribute(PersistentType parent, Accessor accessor) {
- super(parent);
- this.accessor = accessor;
- this.initialize();
- }
-
- protected void initialize() {
- // this is determined directly from the resource model
- this.defaultAccess = this.buildDefaultAccess();
- this.specifiedAccess = this.buildSpecifiedAccess();
-
- // keep non-null at all times
- this.mapping = this.buildMapping();
- }
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- // this is determined directly from the resource model
- this.setDefaultAccess(this.buildDefaultAccess());
- this.setSpecifiedAccess_(this.buildSpecifiedAccess());
- this.syncMapping();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateMapping();
- }
-
- // ********** name **********
-
- /**
- * name will not change in java, a new persistent attribute will be built.
- */
- public String getName() {
- return this.getResourceAttribute().getName();
- }
-
-
- public Accessor getAccessor() {
- return this.accessor;
- }
-
- public boolean isFor(JavaResourceField resourceField) {
- return this.accessor.isFor(resourceField);
- }
-
- public boolean isFor(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
- return this.accessor.isFor(resourceGetter, resourceSetter);
- }
-
- // ********** access **********
-
- public AccessType getAccess() {
- AccessType access = this.getSpecifiedAccess();
- return (access != null) ? access : this.defaultAccess;
- }
-
- 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 getAccessor().getDefaultAccess();
- }
-
- 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);
- }
-
- /**
- * a specified Access annotation is only supported by JPA 2.0, but
- * putting this code here to simplify. A 1.0 persistent attribute
- * will never have an Access annotation on it, specifiedAccess will
- * always be null.
- */
- protected AccessType buildSpecifiedAccess() {
- Access2_0Annotation accessAnnotation = this.getAccessAnnotation();
- return (accessAnnotation == null) ? null : AccessType.fromJavaResourceModel(accessAnnotation.getValue());
- }
-
- protected Access2_0Annotation getAccessAnnotation() {
- return (Access2_0Annotation) this.getResourceAttribute().getAnnotation(Access2_0Annotation.ANNOTATION_NAME);
- }
-
-
- // ********** 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.getResourceAttribute().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.getResourceAttribute().getNameTextRange(astRoot);
- }
-
- protected CompilationUnit buildASTRoot() {
- return this.getResourceAttribute().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 JDTTools.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 (JDTTools.typeIsOtherValidBasicType(typeName)) {
- return true;
- }
- if (this.getResourceAttribute().typeIsEnum()) {
- return true;
- }
- if (this.getResourceAttribute().typeIsSubTypeOf(SERIALIZABLE_TYPE_NAME)) {
- return true;
- }
- return false;
- }
-
- 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.getResourceAttribute());
- }
-
- public String getMultiReferenceMapKeyTypeName() {
- return this.getJpaContainerDefinition().getMultiReferenceMapKeyTypeName(this.getResourceAttribute());
- }
-
- /**
- * 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 JavaResourceAttribute getResourceAttribute() {
- return this.accessor.getResourceAttribute();
- }
-
- public String getPrimaryKeyColumnName() {
- return this.mapping.getPrimaryKeyColumnName();
- }
-
- public String getTypeName() {
- return this.getResourceAttribute().getTypeName();
- }
-
- public boolean contains(int offset, CompilationUnit astRoot) {
- TextRange fullTextRange = this.getResourceAttribute().getTextRange(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);
- }
-
- public Embeddable getEmbeddable() {
- String typeName = this.getTypeName();
- return (typeName == null) ? null : this.getPersistenceUnit().getEmbeddable(typeName);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.isVirtual() ?
- this.getOwningPersistentType().getValidationTextRange() :
- 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.mapping.validate(messages, reporter, astRoot);
- }
-
- protected void validateAttribute(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- this.buildAttributeValidator(astRoot).validate(messages, reporter);
- }
-
- protected abstract JptValidator buildAttributeValidator(CompilationUnit astRoot);
-
- protected PersistentAttributeTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
- return new JavaPersistentAttributeTextRangeResolver(this, astRoot);
- }
-
- /**
- * If the attribute's owning type is an <code>orm.xml</code> persistent
- * type, the attribute must be one of the type's default attributes.
- * (Actually, the Java attribute is held by a <em>virtual</em>
- * <code>orm.xml</code> attribute
- * (see {@link org.eclipse.jpt.jpa.core.internal.context.orm.VirtualOrmPersistentAttribute})
- * that is held by the <code>orm.xml</code> type.
- * The <em>virtual</em> attribute returns the Java attribute's mapping
- * as its own.)
- */
- public boolean isVirtual() {
- IContentType persistentTypeContentType = this.getOwningPersistentType().getResourceType().getContentType();
- return ! persistentTypeContentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)
- && ! persistentTypeContentType.isKindOf(JptCommonCorePlugin.JAR_CONTENT_TYPE);
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return this.mapping.getJavaCompletionProposals(pos, filter, astRoot);
- }
-
-
- // ********** metamodel **********
-
- public String getMetamodelContainerFieldTypeName() {
- return this.getJpaContainerDefinition().getMetamodelContainerFieldTypeName();
- }
-
- public String getMetamodelContainerFieldMapKeyTypeName() {
- return this.getJpaContainerDefinition().getMetamodelContainerFieldMapKeyTypeName((CollectionMapping) this.mapping);
- }
-
- 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.getResourceAttribute().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(JavaResourceAttribute resourceAttribute) {
- return (resourceAttribute.getTypeTypeArgumentNamesSize() == 1) ?
- resourceAttribute.getTypeTypeArgumentName(0) :
- null;
- }
-
- public String getMultiReferenceMapKeyTypeName(JavaResourceAttribute resourceAttribute) {
- 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(JavaResourceAttribute resourceAttribute) {
- return (resourceAttribute.getTypeTypeArgumentNamesSize() == 2) ?
- resourceAttribute.getTypeTypeArgumentName(1) :
- null;
- }
-
- public String getMultiReferenceMapKeyTypeName(JavaResourceAttribute resourceAttribute) {
- return (resourceAttribute.getTypeTypeArgumentNamesSize() == 2) ?
- resourceAttribute.getTypeTypeArgumentName(0) :
- null;
- }
-
- public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) {
- return mapping.getMetamodelFieldMapKeyTypeName();
- }
-
- public boolean isMap() {
- return true;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
deleted file mode 100644
index eac3f48a8e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java
+++ /dev/null
@@ -1,1115 +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.jpa.core.internal.context.java;
-
-import java.lang.reflect.Modifier;
-import java.util.Collection;
-import java.util.HashSet;
-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.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNode;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaStructureNodes;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-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 JavaResourceType resourceType;
-
- 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 AbstractJavaPersistentType(PersistentType.Owner parent, JavaResourceType resourceType) {
- super(parent);
- this.resourceType = resourceType;
- this.name = this.resourceType.getQualifiedName();
- this.specifiedAccess = this.buildSpecifiedAccess();
-
- // keep this non-null
- this.defaultAccess = AccessType.FIELD;
-
- this.mapping = this.buildMapping();
- this.initializeAttributes();
-
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setName(this.resourceType.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<JavaResourceType> visited = new HashSet<JavaResourceType>();
- visited.add(this.resourceType);
- PersistentType spt = this.resolveSuperPersistentType(this.resourceType.getSuperclassQualifiedName(), visited);
- if (spt == null) {
- return null;
- }
- if (CollectionTools.contains(spt.getInheritanceHierarchy(), 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<JavaResourceType> visited) {
- if (typeName == null) {
- return null;
- }
- JavaResourceType resourceType = (JavaResourceType) this.getJpaProject().getJavaResourceType(typeName, JavaResourceAnnotatedElement.Kind.TYPE);
- 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 annotation **********
-
- protected Access2_0Annotation getAccessAnnotation() {
- return (Access2_0Annotation) this.resourceType.getNonNullAnnotation(this.getAccessAnnotationName());
- }
-
- protected void removeAccessAnnotationIfUnset() {
- Access2_0Annotation accessAnnotation = this.getAccessAnnotation();
- if (accessAnnotation != null && accessAnnotation.isUnset()) {
- this.removeAccessAnnotation();
- }
- }
-
- protected void removeAccessAnnotation() {
- this.resourceType.removeAnnotation(this.getAccessAnnotationName());
- }
-
- protected String getAccessAnnotationName() {
- return Access2_0Annotation.ANNOTATION_NAME;
- }
-
-
- // ********** access **********
-
- public AccessType getAccess() {
- return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess;
- }
-
- public AccessType getSpecifiedAccess() {
- return this.specifiedAccess;
- }
-
- public void setSpecifiedAccess(AccessType access) {
- if (this.valuesAreDifferent(this.specifiedAccess, access)) {
- this.getAccessAnnotation().setValue(AccessType.toJavaResourceModel(access));
- this.removeAccessAnnotationIfUnset();
- this.setSpecifiedAccess_(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.fromJavaResourceModel(this.getAccessAnnotation().getValue());
- }
-
- 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 = buildAccess(this.resourceType);
- 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.resourceType.setPrimaryAnnotation(definition.getAnnotationName(), definition.getSupportingAnnotationNames());
- return definition.buildMapping(this, annotation, this.getJpaFactory());
- }
- }
- this.resourceType.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.resourceType.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.resourceType.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 ListIterable<JavaPersistentAttribute> getAttributes() {
- return new LiveCloneListIterable<JavaPersistentAttribute>(this.attributes);
- }
-
- public int getAttributesSize() {
- return this.attributes.size();
- }
-
- public 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(JavaResourceAttribute javaResourceAttribute) {
- for (JavaPersistentAttribute javaAttribute : this.getAttributes()) {
- if (javaAttribute.getResourceAttribute() == javaResourceAttribute) {
- return javaAttribute;
- }
- }
- return null;
- }
-
- public Iterable<ReadOnlyPersistentAttribute> getAllAttributes() {
- return new CompositeIterable<ReadOnlyPersistentAttribute>(
- new TransformationIterable<PersistentType, Iterable<ReadOnlyPersistentAttribute>>(this.getInheritanceHierarchy()) {
- @Override
- protected Iterable<ReadOnlyPersistentAttribute> transform(PersistentType pt) {
- return new SuperListIterableWrapper<ReadOnlyPersistentAttribute>(pt.getAttributes());
- }
- }
- );
- }
-
- public 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 JavaPersistentAttribute buildField(JavaResourceField resourceField) {
- return getJpaFactory().buildJavaPersistentField(this, resourceField);
- }
-
- protected JavaPersistentAttribute buildProperty(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
- return getJpaFactory().buildJavaPersistentProperty(this, resourceGetter, resourceSetter);
- }
-
- public boolean hasAnyAnnotatedAttributes() {
- return this.resourceType.hasAnyAnnotatedFields() || this.resourceType.hasAnyAnnotatedMethods();
- }
-
- protected void moveAttribute(int index, JavaPersistentAttribute attribute) {
- this.moveItemInList(index, attribute, this.attributes, ATTRIBUTES_LIST);
- }
-
- protected void addAttribute(int index, JavaPersistentAttribute persistentAttribute) {
- this.addItemToList(index, persistentAttribute, this.attributes, ATTRIBUTES_LIST);
- }
-
- protected void removeAttribute(JavaPersistentAttribute attribute) {
- this.removeItemFromList(attribute, this.attributes, ATTRIBUTES_LIST);
- }
-
- protected void initializeAttributes() {
- if (getAccess() == AccessType.FIELD) {
- this.intializeFieldAccessAttributes();
- }
- else if (getAccess() == AccessType.PROPERTY) {
- this.intializePropertyAccessAttributes();
- }
- }
-
- /**
- * Initialize the attributes for AccessType.FIELD
- * 1. all non-transient, non-static fields
- * 2. all annotated methods (getters/setters)
- */
- private void intializeFieldAccessAttributes() {
- this.initializeFieldAttributes(buildNonTransientNonStaticResourceFieldsFilter());
- this.initializeAnnotatedPropertyAttributes();
- }
-
- private void initializeFieldAttributes(Filter<JavaResourceField> filter) {
- for (JavaResourceField resourceField : this.getResourceFields(filter)) {
- this.attributes.add(this.buildField(resourceField));
- }
- }
-
- /**
- * Initialize the attributes for XmlAccessType.PROPERTY
- * 1. all getter/setter javabeans pairs
- * 2. all annotated fields
- * 3. all annotated methods getters/setters that don't have a matching pair
- */
- private void intializePropertyAccessAttributes() {
- this.initializeFieldAttributes(ANNOTATED_RESOURCE_FIELDS_FILTER);
-
- Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getResourceMethods());
- //iterate through all resource methods searching for persistable getters
- for (JavaResourceMethod getterMethod : this.getResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) {
- JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods);
- if (methodsArePersistableProperties(getterMethod, setterMethod)) {
- this.attributes.add(this.buildProperty(getterMethod, setterMethod));
- }
- resourceMethods.remove(getterMethod);
- resourceMethods.remove(setterMethod);
- }
- this.initializeRemainingResourceMethodAttributes(resourceMethods);
- }
-
- private void initializeAnnotatedPropertyAttributes() {
- Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getResourceMethods());
- //iterate through all resource methods searching for persistable getters
- for (JavaResourceMethod getterMethod : this.getResourceMethods(buildPersistablePropertyGetterMethodsFilter())) {
- JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods);
- if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) {
- this.attributes.add(this.buildProperty(getterMethod, setterMethod));
- }
- resourceMethods.remove(getterMethod);
- resourceMethods.remove(setterMethod);
- }
- this.initializeRemainingResourceMethodAttributes(resourceMethods);
- }
-
- private void initializeRemainingResourceMethodAttributes(Collection<JavaResourceMethod> resourceMethods) {
- //iterate through remaining resource methods and search for those that are annotated.
- //all getter methods will already be used.
- for (JavaResourceMethod resourceMethod : resourceMethods) {
- if (resourceMethod.isAnnotated()) {
- //annotated setter(or other random method) with no corresponding getter, bring into context model for validation purposes
- this.attributes.add(this.buildProperty(null, resourceMethod));
- }
- }
- }
-
- /**
- * 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() {
- if (getAccess() == AccessType.FIELD) {
- this.syncFieldAccessAttributes();
- }
- else if (getAccess() == AccessType.PROPERTY) {
- this.syncPropertyAccessAttributes();
- }
- }
-
- /**
- * Initialize the attributes for AccessType.FIELD
- * 1. all non-transient, non-static fields
- * 2. all annotated methods(getters/setters)
- */
- private void syncFieldAccessAttributes() {
- HashSet<JavaPersistentAttribute> contextAttributes = CollectionTools.set(this.getAttributes());
-
- this.syncFieldAttributes(contextAttributes, this.buildNonTransientNonStaticResourceFieldsFilter());
- this.syncAnnotatedPropertyAttributes(contextAttributes);
- }
-
- /**
- * Initialize the attributes for XmlAccessType.PROPERTY
- * 1. all getter/setter javabeans pairs
- * 2. all annotated fields
- * 3. all annotated methods getters/setters that don't have a matching pair
- */
- private void syncPropertyAccessAttributes() {
- HashSet<JavaPersistentAttribute> contextAttributes = CollectionTools.set(this.getAttributes());
-
- this.syncFieldAttributes(contextAttributes, ANNOTATED_RESOURCE_FIELDS_FILTER);
-
- Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getResourceMethods());
- //iterate through all resource methods searching for persistable getters
- for (JavaResourceMethod getterMethod : this.getResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) {
- JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods);
- if (methodsArePersistableProperties(getterMethod, setterMethod)) {
- boolean match = false;
- for (Iterator<JavaPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
- JavaPersistentAttribute contextAttribute = stream.next();
- if (contextAttribute.isFor(getterMethod, setterMethod)) {
- match = true;
- contextAttribute.update();
- stream.remove();
- break;
- }
- }
- if (!match) {
- this.addAttribute(getAttributesSize(), this.buildProperty(getterMethod, setterMethod));
- }
- }
- resourceMethods.remove(getterMethod);
- resourceMethods.remove(setterMethod);
- }
- this.syncRemainingResourceMethods(contextAttributes, resourceMethods);
- }
-
- private void syncAnnotatedPropertyAttributes(HashSet<JavaPersistentAttribute> contextAttributes) {
- Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getResourceMethods());
- //iterate through all resource methods searching for persistable getters
- for (JavaResourceMethod getterMethod : this.getResourceMethods(buildPersistablePropertyGetterMethodsFilter())) {
- JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods);
- if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) {
- boolean match = false;
- for (Iterator<JavaPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
- JavaPersistentAttribute contextAttribute = stream.next();
- if (contextAttribute.isFor(getterMethod, setterMethod)) {
- match = true;
- contextAttribute.update();
- stream.remove();
- break;
- }
- }
- if (!match) {
- this.addAttribute(getAttributesSize(), this.buildProperty(getterMethod, setterMethod));
- }
- }
- resourceMethods.remove(getterMethod);
- resourceMethods.remove(setterMethod);
- }
- this.syncRemainingResourceMethods(contextAttributes, resourceMethods);
- }
-
- private void syncFieldAttributes(HashSet<JavaPersistentAttribute> contextAttributes, Filter<JavaResourceField> filter) {
- for (JavaResourceField resourceField : this.getResourceFields(filter)) {
- boolean match = false;
- for (Iterator<JavaPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext(); ) {
- JavaPersistentAttribute contextAttribute = stream.next();
- if (contextAttribute.isFor(resourceField)) {
- match = true;
- contextAttribute.update();
- stream.remove();
- 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)
- this.addAttribute(this.getAttributesSize(), this.buildField(resourceField));
- }
- }
- }
-
- private void syncRemainingResourceMethods(HashSet<JavaPersistentAttribute> contextAttributes, Collection<JavaResourceMethod> resourceMethods) {
- //iterate through remaining resource methods and search for those that are annotated.
- //all getter methods will already be used.
- for (JavaResourceMethod resourceMethod : resourceMethods) {
- if (resourceMethod.isAnnotated()) {
- boolean match = false;
- //annotated setter(or other random method) with no corresponding getter, bring into context model for validation purposes
- for (Iterator<JavaPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
- JavaPersistentAttribute contextAttribute = stream.next();
- if (contextAttribute.isFor(null, resourceMethod)) {
- match = true;
- contextAttribute.update();
- stream.remove();
- break;
- }
- }
- if (!match) {
- this.addAttribute(getAttributesSize(), this.buildProperty(null, resourceMethod));
- }
- }
- }
-
- // remove any leftover context attributes
- for (JavaPersistentAttribute contextAttribute : contextAttributes) {
- this.removeAttribute(contextAttribute);
- }
- }
-
-
- protected Iterable<JavaResourceField> getResourceFields() {
- return this.resourceType.getFields();
- }
-
- protected Iterable<JavaResourceMethod> getResourceMethods() {
- return this.resourceType.getMethods();
- }
-
- protected Iterable<JavaResourceField> getResourceFields(Filter<JavaResourceField> filter) {
- return new FilteringIterable<JavaResourceField>(getResourceFields(), filter);
- }
-
- protected Iterable<JavaResourceMethod> getResourceMethods(Filter<JavaResourceMethod> filter) {
- return new FilteringIterable<JavaResourceMethod>(getResourceMethods(), filter);
- }
-
- public static Filter<JavaResourceField> buildNonTransientNonStaticResourceFieldsFilter() {
- return new Filter<JavaResourceField>() {
- public boolean accept(JavaResourceField resourceField) {
- return memberIsNonTransientNonStatic(resourceField) || resourceField.isAnnotated();
- }
- };
- }
-
- protected static boolean memberIsNonTransientNonStatic(JavaResourceMember resourceMember) {
- return !resourceMember.isTransient() && !resourceMember.isStatic();
- }
-
- public static Filter<JavaResourceField> ANNOTATED_RESOURCE_FIELDS_FILTER =
- new Filter<JavaResourceField>() {
- public boolean accept(JavaResourceField resourceField) {
- return resourceField.isAnnotated();
- }
- };
-
- protected Filter<JavaResourceMethod> buildPersistablePropertyGetterMethodsFilter() {
- return new Filter<JavaResourceMethod>() {
- public boolean accept(JavaResourceMethod resourceMethod) {
- return methodIsPersistablePropertyGetter(resourceMethod, getResourceMethods());
- }
- };
- }
-
- /**
- * Return whether the specified method is a "getter" method that
- * represents a property that may be "persisted".
- */
- public static boolean methodIsPersistablePropertyGetter(JavaResourceMethod resourceMethod, Iterable<JavaResourceMethod> allMethods) {
- if (methodHasInvalidModifiers(resourceMethod)) {
- return false;
- }
- if (resourceMethod.isConstructor()) {
- return false;
- }
-
- String returnTypeName = resourceMethod.getTypeName();
- if (returnTypeName == null) {
- return false; // DOM method bindings can have a null name
- }
- if (returnTypeName.equals("void")) { //$NON-NLS-1$
- return false;
- }
- if (methodHasParameters(resourceMethod)) {
- return false;
- }
-
- boolean booleanGetter = methodIsBooleanGetter(resourceMethod);
-
- // if the type has both methods:
- // boolean isProperty()
- // boolean getProperty()
- // then #isProperty() takes precedence and we ignore #getProperty();
- // but only having #getProperty() is OK too
- // (see the JavaBeans spec 1.01)
- if (booleanGetter && methodHasValidSiblingIsMethod(resourceMethod, allMethods)) {
- return false; // since the type also defines #isProperty(), ignore #getProperty()
- }
- return true;
- }
-
- private static boolean methodIsBooleanGetter(JavaResourceMethod resourceMethod) {
- String returnTypeName = resourceMethod.getTypeName();
- String name = resourceMethod.getMethodName();
- boolean booleanGetter = false;
- if (name.startsWith("is")) { //$NON-NLS-1$
- if (returnTypeName.equals("boolean")) { //$NON-NLS-1$
- } else {
- return false;
- }
- } else if (name.startsWith("get")) { //$NON-NLS-1$
- if (returnTypeName.equals("boolean")) { //$NON-NLS-1$
- booleanGetter = true;
- }
- } else {
- return false;
- }
- return booleanGetter;
- }
-
- /**
- * Return whether the method's modifiers prevent it
- * from being a getter or setter for a "persistent" property.
- */
- private static boolean methodHasInvalidModifiers(JavaResourceMethod resourceMethod) {
- int modifiers = resourceMethod.getModifiers();
- if (Modifier.isStatic(modifiers)) {
- return true;
- }
- return false;
- }
-
- private static boolean methodHasParameters(JavaResourceMethod resourceMethod) {
- return resourceMethod.getParametersSize() != 0;
- }
-
- /**
- * Return whether the method has a sibling "is" method for the specified
- * property and that method is valid for a "persistable" property.
- * Pre-condition: the method is a "boolean getter" (e.g. 'public boolean getProperty()');
- * this prevents us from returning true when the method itself is an
- * "is" method.
- */
- private static boolean methodHasValidSiblingIsMethod(JavaResourceMethod getMethod, Iterable<JavaResourceMethod> resourceMethods) {
- String capitalizedAttributeName = StringTools.capitalize(getMethod.getName());
- for (JavaResourceMethod sibling : resourceMethods) {
- if ((sibling.getParametersSize() == 0)
- && sibling.getMethodName().equals("is" + capitalizedAttributeName)) { //$NON-NLS-1$
- return methodIsValidSibling(sibling, "boolean"); //$NON-NLS-1$
- }
- }
- return false;
- }
-
- /**
- * Return whether the method has a sibling "set" method
- * and that method is valid for a "persistable" property.
- */
- public static JavaResourceMethod getValidSiblingSetMethod(JavaResourceMethod getMethod, Iterable<JavaResourceMethod> resourceMethods) {
- String capitalizedAttributeName = StringTools.capitalize(getMethod.getName());
- String parameterTypeErasureName = getMethod.getTypeName();
- for (JavaResourceMethod sibling : resourceMethods) {
- ListIterable<String> siblingParmTypeNames = sibling.getParameterTypeNames();
- if ((sibling.getParametersSize() == 1)
- && sibling.getMethodName().equals("set" + capitalizedAttributeName) //$NON-NLS-1$
- && siblingParmTypeNames.iterator().next().equals(parameterTypeErasureName)) {
- return methodIsValidSibling(sibling, "void") ? sibling : null; //$NON-NLS-1$
- }
- }
- return null;
- }
-
- /**
- * Return whether the specified method is a valid sibling with the
- * specified return type.
- */
- private static boolean methodIsValidSibling(JavaResourceMethod resourceMethod, String returnTypeName) {
- if (resourceMethod == null) {
- return false;
- }
- if (methodHasInvalidModifiers(resourceMethod)) {
- return false;
- }
- if (resourceMethod.isConstructor()) {
- return false;
- }
- String rtName = resourceMethod.getTypeName();
- if (rtName == null) {
- return false; // DOM method bindings can have a null name
- }
- return rtName.equals(returnTypeName);
- }
-
- public static boolean methodsArePersistableProperties(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) {
- if (setterMethod != null) {
- return true;
- }
- else if (getterMethod.isAnnotated()) {
- //annotated getter with no corresponding setter, bring into context model for validation purposes
- return true;
- }
- return false;
- }
-
-
- // ********** inheritance **********
-
- public Iterable<PersistentType> getInheritanceHierarchy() {
- return this.getInheritanceHierarchyOf(this);
- }
-
- 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.resourceType.getTextRange(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);
- }
-
- public TextRange getSelectionTextRange() {
- return this.getSelectionTextRange(this.buildASTRoot());
- }
-
- protected TextRange getSelectionTextRange(CompilationUnit astRoot) {
- return this.resourceType.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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- Iterable<String> values = this.mapping.getJavaCompletionProposals(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- for (JavaPersistentAttribute attribute : this.getAttributes()) {
- values = attribute.getJavaCompletionProposals(pos, filter, astRoot);
- if (values != null) {
- return values;
- }
- }
- return EmptyIterable.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.resourceType.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.resourceType instanceof SourceNode)) {
- // build the AST root here to pass down
- this.validate(messages, reporter, this.buildASTRoot());
- }
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateMapping(messages, reporter, astRoot);
- this.validateAttributes(messages, reporter, astRoot);
- }
-
- protected void validateMapping(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- try {
- this.mapping.validate(messages, reporter, astRoot);
- } catch(Throwable t) {
- JptJpaCorePlugin.log(t);
- }
- }
-
- protected void validateAttributes(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- for (JavaPersistentAttribute attribute : this.getAttributes()) {
- this.validateAttribute(attribute, reporter, messages, astRoot);
- }
- }
-
- protected void validateAttribute(JavaPersistentAttribute attribute, IReporter reporter, List<IMessage> messages, CompilationUnit astRoot) {
- try {
- attribute.validate(messages, reporter, astRoot);
- } catch(Throwable t) {
- JptJpaCorePlugin.log(t);
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getSelectionTextRange(astRoot);
- }
-
- public TextRange getValidationTextRange() {
- return this.getSelectionTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public PersistentType.Owner getParent() {
- return (PersistentType.Owner) super.getParent();
- }
-
- @Override
- public IResource getResource() {
- return this.resourceType.getFile();
- }
-
- public JavaResourceType getJavaResourceType() {
- return this.resourceType;
- }
-
- public AccessType getOwnerOverrideAccess() {
- return this.getParent().getOverridePersistentTypeAccess();
- }
-
- public AccessType getOwnerDefaultAccess() {
- return this.getParent().getDefaultPersistentTypeAccess();
- }
-
- protected CompilationUnit buildASTRoot() {
- return this.resourceType.getJavaResourceCompilationUnit().buildASTRoot();
- }
-
- protected JpaFile getJpaFile() {
- return this.getJpaFile(this.resourceType.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.getJavaResourceType().getPackageName();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** Access type **********
-
- /**
- * Return the access type currently implied by the specified Java source
- * code or class file:<ul>
- * <li>if any fields are annotated =>
- * {@link AccessType#FIELD FIELD}
- * <li>if only properties are annotated =>
- * {@link AccessType#PROPERTY PROPERTY}
- * <li>if neither are annotated =>
- * <code>null</code>
- *
- * </ul>
- */
- public static AccessType buildAccess(JavaResourceType jrType) {
- for (JavaResourceField field : jrType.getFields()) {
- if (field.isAnnotated()) {
- // any field is annotated => FIELD
- return AccessType.FIELD;
- }
- }
-
- for (JavaResourceMethod method : jrType.getMethods()) {
- if (method.isAnnotated()) {
- // none of the fields are annotated and any method is annotated => PROPERTY
- return AccessType.PROPERTY;
- }
- }
-
- // nothing is annotated
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java
deleted file mode 100644
index d1d20d4e7e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java
+++ /dev/null
@@ -1,260 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.Query;
-import org.eclipse.jpt.jpa.core.context.QueryHint;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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 ContextListContainer<JavaQueryHint, QueryHintAnnotation> queryHintContainer;
-
-
- protected AbstractJavaQuery(JavaJpaContextNode parent, A queryAnnotation) {
- super(parent);
- this.queryAnnotation = queryAnnotation;
- this.name = queryAnnotation.getName();
- this.query = queryAnnotation.getQuery();
- this.queryHintContainer = this.buildHintContainer();
- }
-
-
- // ********** 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());
- }
-
-
- // ********** 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 this.queryHintContainer.getContextElements();
- }
-
- public int getHintsSize() {
- return this.queryHintContainer.getContextElementsSize();
- }
-
- public JavaQueryHint addHint() {
- return this.addHint(this.getHintsSize());
- }
-
- public JavaQueryHint addHint(int index) {
- QueryHintAnnotation annotation = this.queryAnnotation.addHint(index);
- return this.queryHintContainer.addContextElement(index, annotation);
- }
-
- public void removeHint(QueryHint hint) {
- this.removeHint(this.queryHintContainer.indexOfContextElement((JavaQueryHint) hint));
- }
-
- public void removeHint(int index) {
- this.queryAnnotation.removeHint(index);
- this.queryHintContainer.removeContextElement(index);
- }
-
- public void moveHint(int targetIndex, int sourceIndex) {
- this.queryAnnotation.moveHint(targetIndex, sourceIndex);
- this.queryHintContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected JavaQueryHint buildHint(QueryHintAnnotation hintAnnotation) {
- return this.getJpaFactory().buildJavaQueryHint(this, hintAnnotation);
- }
-
- protected void syncHints() {
- this.queryHintContainer.synchronizeWithResourceModel();
- }
-
- protected void updateHints() {
- this.queryHintContainer.update();
- }
-
- protected ListIterable<QueryHintAnnotation> getHintAnnotations() {
- return this.queryAnnotation.getHints();
- }
-
- protected ContextListContainer<JavaQueryHint, QueryHintAnnotation> buildHintContainer() {
- return new HintContainer();
- }
-
- /**
- * query hint container
- */
- protected class HintContainer
- extends ContextListContainer<JavaQueryHint, QueryHintAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return HINTS_LIST;
- }
- @Override
- protected JavaQueryHint buildContextElement(QueryHintAnnotation resourceElement) {
- return AbstractJavaQuery.this.buildHint(resourceElement);
- }
- @Override
- protected ListIterable<QueryHintAnnotation> getResourceElements() {
- return AbstractJavaQuery.this.getHintAnnotations();
- }
- @Override
- protected QueryHintAnnotation getResourceElement(JavaQueryHint contextElement) {
- return contextElement.getQueryHintAnnotation();
- }
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateName(messages, astRoot);
- this.validateQuery(messages, reporter, astRoot);
- }
-
- protected void validateName(List<IMessage> messages, CompilationUnit astRoot) {
- if (StringTools.stringIsEmpty(this.name)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.QUERY_NAME_UNDEFINED,
- EMPTY_STRING_ARRAY,
- this,
- this.getNameTextRange(astRoot)
- )
- );
- }
- }
-
- protected void validateQuery(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- if (StringTools.stringIsEmpty(this.query)){
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.QUERY_STATEMENT_UNDEFINED,
- new String[] {this.name},
- this,
- this.getNameTextRange(astRoot)
- )
- );
- } else {
- this.validateQuery_(messages, reporter, astRoot);
- }
- }
-
- protected abstract void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot);
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.queryAnnotation.getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.queryAnnotation.getNameTextRange(astRoot), astRoot);
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
- 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);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java
deleted file mode 100644
index 0760a1be4c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java
+++ /dev/null
@@ -1,61 +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.jpa.core.internal.context.java;
-
-import java.util.Vector;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyUniqueConstraint;
-
-public abstract class AbstractJavaReadOnlyUniqueConstraint
- extends AbstractJavaJpaContextNode
- implements JavaReadOnlyUniqueConstraint
-{
- protected final Vector<String> columnNames = new Vector<String>();
-
-
- public AbstractJavaReadOnlyUniqueConstraint(JavaJpaContextNode parent) {
- super(parent);
- }
-
-
- // ********** column names **********
-
- public Iterable<String> getColumnNames() {
- return new LiveCloneIterable<String>(this.columnNames);
- }
-
- public int getColumnNamesSize() {
- return this.columnNames.size();
- }
-
- public String getColumnName(int index) {
- return this.columnNames.get(index);
- }
-
- protected void syncColumnNames() {
- this.synchronizeList(this.getResourceColumnNames(), this.columnNames, COLUMN_NAMES_LIST);
- }
-
- protected abstract Iterable<String> getResourceColumnNames();
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.columnNames);
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
deleted file mode 100644
index aece5971f3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
+++ /dev/null
@@ -1,361 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaCascade;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaCascade;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java relationship mapping (1:1, 1:m, m:1, m:m)
- */
-public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMappingAnnotation>
- extends AbstractJavaAttributeMapping<A>
- implements JavaRelationshipMapping
-{
- protected String specifiedTargetEntity;
- protected String defaultTargetEntity;
- protected String fullyQualifiedTargetEntity;
-
- protected final JavaMappingRelationship relationship;
-
- protected final JavaCascade cascade;
-
- protected FetchType specifiedFetch;
- protected FetchType defaultFetch;
-
-
- protected AbstractJavaRelationshipMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.specifiedTargetEntity = this.buildSpecifiedTargetEntity();
- this.relationship = this.buildRelationship();
- this.cascade = this.buildCascade();
- this.specifiedFetch = this.buildSpecifiedFetch();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedTargetEntity_(this.buildSpecifiedTargetEntity());
- this.relationship.synchronizeWithResourceModel();
- this.cascade.synchronizeWithResourceModel();
- this.setSpecifiedFetch_(this.buildSpecifiedFetch());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultTargetEntity(this.buildDefaultTargetEntity());
- this.setFullyQualifiedTargetEntity(this.buildFullyQualifiedTargetEntity());
- this.relationship.update();
- this.cascade.update();
- this.setDefaultFetch(this.buildDefaultFetch());
- }
-
-
- // ********** target entity **********
-
- public String getTargetEntity() {
- return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity;
- }
-
- public String getSpecifiedTargetEntity() {
- return this.specifiedTargetEntity;
- }
-
- public void setSpecifiedTargetEntity(String entity) {
- if (this.valuesAreDifferent(entity, this.specifiedTargetEntity)) {
- this.getAnnotationForUpdate().setTargetEntity(entity);
- this.setSpecifiedTargetEntity_(entity);
- }
- }
-
- protected void setSpecifiedTargetEntity_(String entity) {
- String old = this.specifiedTargetEntity;
- this.specifiedTargetEntity = entity;
- this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, entity);
- }
-
- protected String buildSpecifiedTargetEntity() {
- A annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getTargetEntity();
- }
-
- public String getDefaultTargetEntity() {
- return this.defaultTargetEntity;
- }
-
- protected void setDefaultTargetEntity(String entity) {
- String old = this.defaultTargetEntity;
- this.defaultTargetEntity = entity;
- this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, entity);
- }
-
- protected abstract String buildDefaultTargetEntity();
-
- public String getFullyQualifiedTargetEntity() {
- return this.fullyQualifiedTargetEntity;
- }
-
- protected void setFullyQualifiedTargetEntity(String entity) {
- String old = this.fullyQualifiedTargetEntity;
- this.fullyQualifiedTargetEntity = entity;
- this.firePropertyChanged(FULLY_QUALIFIED_TARGET_ENTITY_PROPERTY, old, entity);
- }
-
- protected String buildFullyQualifiedTargetEntity() {
- return (this.specifiedTargetEntity == null) ?
- this.defaultTargetEntity :
- this.getMappingAnnotation().getFullyQualifiedTargetEntityClassName();
- }
-
- public Entity getResolvedTargetEntity() {
- return (this.fullyQualifiedTargetEntity == null) ? null : this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetEntity);
- }
-
- // sub-classes like this to be public
- public PersistentType getResolvedTargetType() {
- return (this.fullyQualifiedTargetEntity == null) ? null : this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTargetEntity);
- }
-
- public char getTargetEntityEnclosingTypeSeparator() {
- return '.';
- }
-
-
- // ********** relationship reference **********
-
- public JavaMappingRelationship getRelationship() {
- return this.relationship;
- }
-
- protected abstract JavaMappingRelationship buildRelationship();
-
-
- // ********** cascade **********
-
- public JavaCascade getCascade() {
- return this.cascade;
- }
-
- protected JavaCascade buildCascade() {
- // NB: we don't use the platform
- return new GenericJavaCascade(this);
- }
-
-
- // ********** fetch **********
-
- public FetchType getFetch() {
- return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType fetch) {
- if (this.valuesAreDifferent(fetch, this.specifiedFetch)) {
- this.getAnnotationForUpdate().setFetch(FetchType.toJavaResourceModel(fetch));
- this.setSpecifiedFetch_(fetch);
- }
- }
-
- protected void setSpecifiedFetch_(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType buildSpecifiedFetch() {
- A annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : FetchType.fromJavaResourceModel(annotation.getFetch());
- }
-
- public FetchType getDefaultFetch() {
- return this.defaultFetch;
- }
-
- protected void setDefaultFetch(FetchType fetch) {
- FetchType old = this.defaultFetch;
- this.defaultFetch = fetch;
- this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
- }
-
- protected abstract FetchType buildDefaultFetch();
-
-
- // ********** misc **********
-
- @Override
- public boolean isRelationshipOwner() {
- return this.relationship.isOwner();
- }
-
- @Override
- public boolean isOwnedBy(AttributeMapping mapping) {
- return mapping.isRelationshipOwner() &&
- this.relationship.isOwnedBy((RelationshipMapping) mapping);
- }
-
- public RelationshipMapping getRelationshipOwner() {
- Entity entity = this.getResolvedTargetEntity();
- if (entity == null) {
- return null;
- }
- for (ReadOnlyPersistentAttribute attribute : entity.getPersistentType().getAllAttributes()) {
- AttributeMapping mapping = attribute.getMapping();
- if (this.isOwnedBy(mapping)) {
- return (RelationshipMapping) mapping;
- }
- }
- return null;
- }
-
- @Override
- public boolean isOverridableAssociationMapping() {
- return this.relationship.isOverridable();
- }
-
- public Iterable<String> getAllTargetEntityAttributeNames() {
- return new CompositeIterable<String>(this.getAllTargetEntityAttributeNamesLists());
- }
-
- protected Iterable<Iterable<String>> getAllTargetEntityAttributeNamesLists() {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getAllTargetEntityAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<AttributeMapping> getAllTargetEntityAttributeMappings() {
- Entity entity = this.getResolvedTargetEntity();
- return (entity != null) ? entity.getAllAttributeMappings() : EmptyIterable.<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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.relationship.getJavaCompletionProposals(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) {
- String msg = this.getPersistentAttribute().isVirtual() ?
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED :
- JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED;
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- msg,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- return;
- }
- if (this.getResolvedTargetEntity() == null) {
- if (this.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY,
- new String[] {this.getName(), this.getTargetEntity()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- } else {
- 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) {
- return this.getValidationTextRange(this.getAnnotationTargetEntityTextRange(astRoot), astRoot);
- }
-
- protected TextRange getAnnotationTargetEntityTextRange(CompilationUnit astRoot) {
- A annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getTargetEntityTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java
deleted file mode 100644
index d6c8ab4277..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java
+++ /dev/null
@@ -1,133 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.db.Schema;
-
-/**
- * Java sequence generator
- */
-public abstract class AbstractJavaSequenceGenerator<A extends SequenceGeneratorAnnotation>
- extends AbstractJavaGenerator<A>
- implements JavaSequenceGenerator
-{
- protected String specifiedSequenceName;
- protected String defaultSequenceName;
-
-
- protected AbstractJavaSequenceGenerator(JavaJpaContextNode parent, A generatorAnnotation) {
- super(parent, generatorAnnotation);
- this.specifiedSequenceName = generatorAnnotation.getSequenceName();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedSequenceName_(this.generatorAnnotation.getSequenceName());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultSequenceName(this.buildDefaultSequenceName());
- }
-
-
- // ********** initial value **********
-
- @Override
- protected int buildDefaultInitialValue() {
- return DEFAULT_INITIAL_VALUE;
- }
-
-
- // ********** sequence name **********
-
- public String getSequenceName() {
- return (this.specifiedSequenceName != null) ? this.specifiedSequenceName : this.defaultSequenceName;
- }
-
- public String getSpecifiedSequenceName() {
- return this.specifiedSequenceName;
- }
-
- public void setSpecifiedSequenceName(String name) {
- this.generatorAnnotation.setSequenceName(name);
- this.setSpecifiedSequenceName_(name);
- }
-
- protected void setSpecifiedSequenceName_(String name) {
- String old = this.specifiedSequenceName;
- this.specifiedSequenceName = name;
- this.firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, old, name);
- }
-
- public String getDefaultSequenceName() {
- return this.defaultSequenceName;
- }
-
- protected void setDefaultSequenceName(String name) {
- String old = this.defaultSequenceName;
- this.defaultSequenceName = name;
- this.firePropertyChanged(DEFAULT_SEQUENCE_NAME_PROPERTY, old, name);
- }
-
- protected String buildDefaultSequenceName() {
- return null; // TODO the default sequence name is determined by the runtime provider...
- }
-
-
- // ********** Java completion proposals **********
-
- /**
- * called if the database is connected:
- * sequenceName
- */
- @Override
- protected Iterable<String> getConnectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getConnectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.sequenceNameTouches(pos, astRoot)) {
- return this.getJavaCandidateSequences(filter);
- }
- return null;
- }
-
- protected boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
- return this.generatorAnnotation.sequenceNameTouches(pos, astRoot);
- }
-
- protected Iterable<String> getJavaCandidateSequences(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateSequences(filter));
- }
-
- protected Iterable<String> getCandidateSequences(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateSequences(), filter);
- }
-
- protected Iterable<String> getCandidateSequences() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema != null) ? dbSchema.getSortedSequenceIdentifiers() : EmptyIterable.<String> instance();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
deleted file mode 100644
index 314a3c74b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java
+++ /dev/null
@@ -1,155 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.java.SingleRelationshipMappingAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java single relationship mapping (1:1, m:1)
- */
-public abstract class AbstractJavaSingleRelationshipMapping<A extends SingleRelationshipMappingAnnotation>
- extends AbstractJavaRelationshipMapping<A>
- implements JavaSingleRelationshipMapping2_0
-{
- protected Boolean specifiedOptional;
- protected boolean defaultOptional;
-
- protected final JavaDerivedIdentity2_0 derivedIdentity;
-
-
- protected AbstractJavaSingleRelationshipMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.specifiedOptional = this.buildSpecifiedOptional();
- this.derivedIdentity = this.buildDerivedIdentity();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedOptional_(this.buildSpecifiedOptional());
- this.derivedIdentity.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultOptional(this.buildDefaultOptional());
- this.derivedIdentity.update();
- }
-
-
- // ********** optional **********
-
- public boolean isOptional() {
- return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.defaultOptional;
- }
-
- public Boolean getSpecifiedOptional() {
- return this.specifiedOptional;
- }
-
- public void setSpecifiedOptional(Boolean optional) {
- if (this.valuesAreDifferent(optional, this.specifiedOptional)) {
- this.getAnnotationForUpdate().setOptional(optional);
- this.setSpecifiedOptional_(optional);
- }
- }
-
- protected void setSpecifiedOptional_(Boolean optional) {
- Boolean old = this.specifiedOptional;
- this.specifiedOptional = optional;
- this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional);
- }
-
- protected Boolean buildSpecifiedOptional() {
- A annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getOptional();
- }
-
- public boolean isDefaultOptional() {
- return this.defaultOptional;
- }
-
- protected void setDefaultOptional(boolean optional) {
- boolean old = this.defaultOptional;
- this.defaultOptional = optional;
- this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional);
- }
-
- protected boolean buildDefaultOptional() {
- return DEFAULT_OPTIONAL;
- }
-
-
- // ********** derived identity **********
-
- public JavaDerivedIdentity2_0 getDerivedIdentity() {
- return this.derivedIdentity;
- }
-
- protected JavaDerivedIdentity2_0 buildDerivedIdentity() {
- return this.isJpa2_0Compatible() ?
- this.getJpaFactory2_0().buildJavaDerivedIdentity(this) :
- new NullJavaDerivedIdentity2_0(this);
- }
-
-
- // ********** misc **********
-
- @Override
- protected FetchType buildDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
- @Override
- protected String buildDefaultTargetEntity() {
- return this.getPersistentAttribute().getSingleReferenceTargetTypeName();
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.derivedIdentity.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.derivedIdentity.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java
deleted file mode 100644
index 5ade84862b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java
+++ /dev/null
@@ -1,552 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.NameTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Database;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java table, secondary table, join table, or collection table
- * <p>
- * <strong>NB:</strong> any subclass that directly holds its table
- * annotation must:<ul>
- * <li>call the "super" constructor that takes a table annotation
- * {@link #AbstractJavaTable(JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, BaseTableAnnotation)}
- * <li>override {@link #setTableAnnotation(BaseTableAnnotation)} to set the table
- * annotation so it is in place before the table's state
- * (e.g. {@link #specifiedName}) is initialized
- * </ul>
- */
-public abstract class AbstractJavaTable<A extends BaseTableAnnotation>
- extends AbstractJavaJpaContextNode
- implements JavaTable, UniqueConstraint.Owner
-{
- protected final Owner owner;
-
- protected String specifiedName;
- protected String defaultName;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected final ContextListContainer<JavaUniqueConstraint, UniqueConstraintAnnotation> uniqueConstraintContainer;
-
-
- 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.uniqueConstraintContainer = this.buildUniqueConstraintContainer();
- }
-
-
- // ********** 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 ListIterable<JavaUniqueConstraint> getUniqueConstraints() {
- return this.uniqueConstraintContainer.getContextElements();
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraintContainer.getContextElementsSize();
- }
-
- public JavaUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraintContainer.getContextElement(index);
- }
-
- public JavaUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.getUniqueConstraintsSize());
- }
-
- public JavaUniqueConstraint addUniqueConstraint(int index) {
- UniqueConstraintAnnotation annotation = this.getTableAnnotation().addUniqueConstraint(index);
- return this.uniqueConstraintContainer.addContextElement(index, annotation);
- }
-
- public void removeUniqueConstraint(int index) {
- this.getTableAnnotation().removeUniqueConstraint(index);
- this.uniqueConstraintContainer.removeContextElement(index);
- }
-
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraintContainer.indexOfContextElement((JavaUniqueConstraint) uniqueConstraint));
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.getTableAnnotation().moveUniqueConstraint(targetIndex, sourceIndex);
- this.uniqueConstraintContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected void syncUniqueConstraints() {
- this.uniqueConstraintContainer.synchronizeWithResourceModel();
- }
-
- protected void updateUniqueConstraints() {
- this.uniqueConstraintContainer.update();
- }
-
- protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) {
- return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation);
- }
-
- protected ListIterable<UniqueConstraintAnnotation> getUniqueConstraintAnnotations() {
- return this.getTableAnnotation().getUniqueConstraints();
- }
-
- protected ContextListContainer<JavaUniqueConstraint, UniqueConstraintAnnotation> buildUniqueConstraintContainer() {
- return new UniqueConstraintContainer();
- }
-
- /**
- * unique constraint container
- */
- protected class UniqueConstraintContainer
- extends ContextListContainer<JavaUniqueConstraint, UniqueConstraintAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return UNIQUE_CONSTRAINTS_LIST;
- }
- @Override
- protected JavaUniqueConstraint buildContextElement(UniqueConstraintAnnotation resourceElement) {
- return AbstractJavaTable.this.buildUniqueConstraint(resourceElement);
- }
- @Override
- protected ListIterable<UniqueConstraintAnnotation> getResourceElements() {
- return AbstractJavaTable.this.getUniqueConstraintAnnotations();
- }
- @Override
- protected UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) {
- return contextElement.getUniqueConstraintAnnotation();
- }
- }
-
-
- // ********** database stuff **********
-
- public org.eclipse.jpt.jpa.db.Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getDbSchemaContainer() {
- String catalog = this.getCatalog();
- return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public Catalog getDbCatalog() {
- String catalog = this.getCatalog();
- return (catalog == null) ? null : this.resolveDbCatalog(catalog);
- }
-
- public boolean isResolved() {
- return this.getDbTable() != null;
- }
-
- public boolean schemaIsResolved() {
- return this.getDbSchema() != null;
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public boolean catalogIsResolved() {
- String catalog = this.getCatalog();
- return (catalog == null) || (this.resolveDbCatalog(catalog) != null);
- }
-
-
- // ********** UniqueConstraint.Owner implementation **********
-
- public Iterable<String> getCandidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.getSortedColumnIdentifiers() : EmptyIterable.<String>instance();
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaUniqueConstraint constraint : this.getUniqueConstraints()) {
- result = constraint.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * called if the database is connected:
- * name, schema, catalog
- */
- @Override
- protected Iterable<String> getConnectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getConnectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.nameTouches(pos, astRoot)) {
- return this.getJavaCandidateNames(filter);
- }
- if (this.schemaTouches(pos, astRoot)) {
- return this.getJavaCandidateSchemata(filter);
- }
- if (this.catalogTouches(pos, astRoot)) {
- return this.getJavaCandidateCatalogs(filter);
- }
- 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) {
- TextRange textRange = this.getTableAnnotation().getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.getTableAnnotation().getNameTextRange(astRoot), astRoot);
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.getTableAnnotation().getSchemaTextRange(astRoot), astRoot);
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.getTableAnnotation().getCatalogTextRange(astRoot), 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 : oldTable.getUniqueConstraints()) {
- this.addUniqueConstraint().initializeFrom(constraint);
- }
- }
-
- protected void initializeFromVirtual(ReadOnlyTable virtualTable) {
- this.setSpecifiedName(virtualTable.getName());
- // ignore other settings?
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.buildQualifiedName());
- }
-
- protected String buildQualifiedName() {
- return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
- }
-
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java
deleted file mode 100644
index cf4f409fed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java
+++ /dev/null
@@ -1,287 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.NotNullFilter;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java type mapping
- */
-public abstract class AbstractJavaTypeMapping<A extends Annotation>
- extends AbstractJavaJpaContextNode
- implements JavaTypeMapping
-{
- // this can be null for a "null" type mapping
- protected final A mappingAnnotation;
-
-
- protected AbstractJavaTypeMapping(JavaPersistentType parent, A mappingAnnotation) {
- super(parent);
- this.mappingAnnotation = mappingAnnotation;
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaPersistentType getParent() {
- return (JavaPersistentType) super.getParent();
- }
-
- public JavaPersistentType getPersistentType() {
- return this.getParent();
- }
-
- public JavaResourceType getJavaResourceType() {
- return this.getPersistentType().getJavaResourceType();
- }
-
- public String getName() {
- return this.getPersistentType().getName();
- }
-
- public A getMappingAnnotation() {
- return this.mappingAnnotation;
- }
-
- public boolean attributeIsDerivedId(String attributeName) {
- return TypeMappingTools.attributeIsDerivedId(this, attributeName);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getPersistentType().getName());
- }
-
-
- // ********** tables **********
-
- public String getPrimaryTableName() {
- return null;
- }
-
- public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() {
- return null;
- }
-
- public Schema getDbSchema() {
- return null;
- }
-
- public Iterable<ReadOnlyTable> getAssociatedTables() {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReadOnlyTable> getAllAssociatedTables() {
- return EmptyIterable.instance();
- }
-
- public Iterable<String> getAllAssociatedTableNames() {
- return EmptyIterable.instance();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return null;
- }
-
-
- // ********** inheritance **********
-
- public TypeMapping getSuperTypeMapping() {
- PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType();
- return (superPersistentType == null) ? null : superPersistentType.getMapping();
- }
-
- public Iterable<TypeMapping> getInheritanceHierarchy() {
- return this.convertToMappings(this.getPersistentType().getInheritanceHierarchy());
- }
-
- /**
- * 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 Iterable<TypeMapping> getAncestors() {
- return this.convertToMappings(this.getPersistentType().getAncestors());
- }
-
- protected Iterable<TypeMapping> convertToMappings(Iterable<PersistentType> types) {
- return new TransformationIterable<PersistentType, TypeMapping>(types) {
- @Override
- protected TypeMapping transform(PersistentType type) {
- return type.getMapping();
- }
- };
- }
-
-
- // ********** attribute mappings **********
-
- public Iterable<JavaAttributeMapping> getAttributeMappings() {
- return new TransformationIterable<JavaPersistentAttribute, JavaAttributeMapping>(this.getPersistentType().getAttributes()) {
- @Override
- protected JavaAttributeMapping transform(JavaPersistentAttribute attribute) {
- return attribute.getMapping();
- }
- };
- }
-
- public Iterable<JavaAttributeMapping> getAttributeMappings(final String mappingKey) {
- return new FilteringIterable<JavaAttributeMapping>(this.getAttributeMappings()) {
- @Override
- protected boolean accept(JavaAttributeMapping o) {
- return Tools.valuesAreEqual(o.getKey(), mappingKey);
- }
- };
- }
-
- public Iterable<AttributeMapping> getAllAttributeMappings() {
- return new CompositeIterable<AttributeMapping>(this.getAllAttributeMappingsLists());
- }
-
- protected Iterable<Iterable<AttributeMapping>> getAllAttributeMappingsLists() {
- return new TransformationIterable<TypeMapping, Iterable<AttributeMapping>>(this.getNonNullInheritanceHierarchy(), TypeMappingTools.ATTRIBUTE_MAPPINGS_TRANSFORMER);
- }
-
- protected Iterable<TypeMapping> getNonNullInheritanceHierarchy() {
- return new FilteringIterable<TypeMapping>(this.getInheritanceHierarchy(), NotNullFilter.<TypeMapping>instance());
- }
-
- public Iterable<AttributeMapping> getAllAttributeMappings(final String mappingKey) {
- return new FilteringIterable<AttributeMapping>(CollectionTools.collection(this.getAllAttributeMappings())) {
- @Override
- protected boolean accept(AttributeMapping o) {
- return Tools.valuesAreEqual(o.getKey(), mappingKey);
- }
- };
- }
-
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return true;
- }
-
-
- // ********** attribute overrides **********
-
- public Iterable<String> getOverridableAttributeNames() {
- return new CompositeIterable<String>(this.getOverridableAttributeNamesLists());
- }
-
- protected Iterable<Iterable<String>> getOverridableAttributeNamesLists() {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getAttributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
- }
-
- public Iterable<String> getAllOverridableAttributeNames() {
- return new CompositeIterable<String>(this.allOverridableAttributeNamesLists());
- }
-
- protected Iterable<Iterable<String>> allOverridableAttributeNamesLists() {
- return new TransformationIterable<TypeMapping, Iterable<String>>(this.getInheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER);
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- for (AttributeMapping attributeMapping : this.getAttributeMappings()) {
- Column column = attributeMapping.resolveOverriddenColumn(attributeName);
- if (column != null) {
- return column;
- }
- }
- return null;
- }
-
-
- // ********** association overrides **********
-
- public Iterable<String> getOverridableAssociationNames() {
- return new CompositeIterable<String>(this.getOverridableAssociationNamesLists());
- }
-
- protected Iterable<Iterable<String>> getOverridableAssociationNamesLists() {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getAttributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
- }
-
- public Iterable<String> getAllOverridableAssociationNames() {
- return new CompositeIterable<String>(this.getAllOverridableAssociationNamesLists());
- }
-
- protected Iterable<Iterable<String>> getAllOverridableAssociationNamesLists() {
- return new TransformationIterable<TypeMapping, Iterable<String>>(this.getInheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER);
- }
-
- public Relationship resolveOverriddenRelationship(String attributeName) {
- for (AttributeMapping attributeMapping : this.getAttributeMappings()) {
- 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.getJavaResourceType(), buildTextRangeResolver(astRoot));
- }
-
- protected TypeMappingTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
- return new JavaTypeMappingTextRangeResolver(this, astRoot);
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getPersistenceUnit().validatesAgainstDatabase();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.mappingAnnotation.getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getPersistentType().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java
deleted file mode 100644
index 28d8530aa3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java
+++ /dev/null
@@ -1,293 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.Association;
-import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java version mapping
- */
-public abstract class AbstractJavaVersionMapping
- extends AbstractJavaAttributeMapping<VersionAnnotation>
- implements JavaVersionMapping
-{
- protected final JavaColumn column;
-
- protected JavaConverter converter; // never null
-
-
- // the spec does not list Temporal explicitly,
- // but it is included in the orm.xml schema...
- protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] {
- JavaTemporalConverter.Adapter.instance(),
- };
- protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
-
-
- protected AbstractJavaVersionMapping(JavaPersistentAttribute parent) {
- super(parent);
- this.column = this.buildColumn();
- this.converter = this.buildConverter();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.column.synchronizeWithResourceModel();
- this.syncConverter();
- }
-
- @Override
- public void update() {
- super.update();
- this.column.update();
- this.converter.update();
- }
-
-
- // ********** column **********
-
- public JavaColumn getColumn() {
- return this.column;
- }
-
- protected JavaColumn buildColumn() {
- return this.getJpaFactory().buildJavaColumn(this, this);
- }
-
-
- // ********** converter **********
-
- public JavaConverter getConverter() {
- return this.converter;
- }
-
- public void setConverter(Class<? extends Converter> converterType) {
- if (this.converter.getType() != converterType) {
- this.converter.dispose();
- JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
- this.retainConverterAnnotation(converterAdapter);
- this.setConverter_(this.buildConverter(converterAdapter));
- }
- }
-
- protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) {
- return (converterAdapter != null) ?
- converterAdapter.buildNewConverter(this, this.getJpaFactory()) :
- this.buildNullConverter();
- }
-
- protected void setConverter_(JavaConverter converter) {
- Converter old = this.converter;
- this.converter = converter;
- this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
- }
-
- /**
- * Clear all the converter annotations <em>except</em> for the annotation
- * corresponding to the specified adapter. If the specified adapter is
- * <code>null</code>, remove <em>all</em> the converter annotations.
- */
- protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) {
- JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
- 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() {
- JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
- 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.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
- }
-
- public void removeColumnAnnotation() {
- this.getResourceAttribute().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 Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.column.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.converter.getJavaCompletionProposals(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);
- this.validateAttributeType(messages, astRoot);
- }
-
- protected void validateAttributeType(List<IMessage> messages, CompilationUnit astRoot) {
- if (!ArrayTools.contains(SUPPORTED_TYPE_NAMES, this.getPersistentAttribute().getTypeName())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java
deleted file mode 100644
index 67fa2d9cae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java
+++ /dev/null
@@ -1,265 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.VirtualBaseColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-
-public abstract class AbstractJavaVirtualBaseColumn<O extends JavaReadOnlyBaseColumn.Owner, C extends ReadOnlyBaseColumn>
- extends AbstractJavaVirtualNamedColumn<O, C>
- implements VirtualBaseColumn, JavaReadOnlyBaseColumn
-{
- 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 **********
-
- @Override
- 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;
- }
-
-
- // ********** misc **********
-
- public boolean tableNameIsInvalid() {
- return this.owner.tableNameIsInvalid(this.getTable());
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.owner.getCandidateTableNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getTableTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
- return new JavaBaseColumnTextRangeResolver(this, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
deleted file mode 100644
index 163294d6e4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java
+++ /dev/null
@@ -1,191 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.VirtualNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java 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 it is 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 ReadOnlyNamedColumn>
- extends AbstractJavaJpaContextNode
- implements VirtualNamedColumn, JavaReadOnlyNamedColumn
-{
- 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();
- }
-
-
- // ********** 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 AbstractJavaVirtualBaseColumn} 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, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.buildValidator(astRoot).validate(messages, reporter);
- }
-
- protected JptValidator buildValidator(CompilationUnit astRoot) {
- return this.owner.buildColumnValidator(this, this.buildTextRangeResolver(astRoot));
- }
-
- protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
- return new JavaNamedColumnTextRangeResolver(this, astRoot);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getParent().getValidationTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- String table = this.getTable();
- if (table != null) {
- sb.append(table);
- sb.append('.');
- }
- sb.append(this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java
deleted file mode 100644
index 023cc4efef..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java
+++ /dev/null
@@ -1,118 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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();
- }
-
- protected C getContainer() {
- return this.getParent();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getContainer().getTypeMapping();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getContainer().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getContainer().getDefaultTableName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyBaseColumn column, Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, column, owner, textRangeResolver);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** 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().buildOverrideValidator(this, this.buildTextRangeResolver(astRoot));
- }
-
- protected OverrideTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
- return new JavaOverrideTextRangeResolver(this, astRoot);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getContainer().getValidationTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getContainer().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getContainer().getCandidateTableNames();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
deleted file mode 100644
index f351c8be5c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java
+++ /dev/null
@@ -1,212 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
-import org.eclipse.jpt.jpa.core.context.VirtualReferenceTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaVirtualReferenceTable<T extends ReadOnlyReferenceTable>
- extends AbstractJavaVirtualTable<T>
- implements VirtualReferenceTable
-{
- protected final ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn> specifiedJoinColumnContainer;
- protected final JavaReadOnlyJoinColumn.Owner joinColumnOwner;
-
- protected JavaVirtualJoinColumn defaultJoinColumn;
-
-
- protected AbstractJavaVirtualReferenceTable(JavaJpaContextNode parent, Owner owner, T overridenTable) {
- super(parent, owner, overridenTable);
- this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
- this.joinColumnOwner = this.buildJoinColumnOwner();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedJoinColumns();
- this.updateDefaultJoinColumn();
- }
-
-
- // ********** join columns **********
-
- public ListIterable<JavaVirtualJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int getJoinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns() {
- return this.specifiedJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- return this.specifiedJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.getSpecifiedJoinColumnsSize() != 0;
- }
-
- public JavaVirtualJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumnContainer.getContextElement(index);
- }
-
- protected void updateSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.update();
- }
-
- protected ListIterable<ReadOnlyJoinColumn> getOverriddenJoinColumns() {
- return new SuperListIterableWrapper<ReadOnlyJoinColumn>(this.getOverriddenTable().getSpecifiedJoinColumns());
- }
-
- protected void moveSpecifiedJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
- this.specifiedJoinColumnContainer.moveContextElement(index, joinColumn);
- }
-
- protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) {
- return this.specifiedJoinColumnContainer.addContextElement(index, joinColumn);
- }
-
- protected void removeSpecifiedJoinColumn(JavaVirtualJoinColumn joinColumn) {
- this.specifiedJoinColumnContainer.removeContextElement(joinColumn);
- }
-
- protected ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedJoinColumnContainer() {
- return new SpecifiedJoinColumnContainer();
- }
-
- /**
- * specified join column container
- */
- protected class SpecifiedJoinColumnContainer
- extends ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
- return AbstractJavaVirtualReferenceTable.this.buildJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
- return AbstractJavaVirtualReferenceTable.this.getOverriddenJoinColumns();
- }
- @Override
- protected ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
- return contextElement.getOverriddenColumn();
- }
- }
-
-
- // ********** 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(ReadOnlyJoinColumn joinColumn) {
- return this.buildJoinColumn(this.joinColumnOwner, joinColumn);
- }
-
- protected JavaVirtualJoinColumn buildJoinColumn(JavaReadOnlyJoinColumn.Owner columnOwner, ReadOnlyJoinColumn joinColumn) {
- return this.getJpaFactory().buildJavaVirtualJoinColumn(this, columnOwner, joinColumn);
- }
-
- protected abstract JavaReadOnlyJoinColumn.Owner buildJoinColumnOwner();
-
- @Override
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
-
- // ********** 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.validateNodes(this.getJoinColumns(), messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java
deleted file mode 100644
index 3adde36a20..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java
+++ /dev/null
@@ -1,365 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.NameTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.VirtualTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractJavaVirtualTable<T extends ReadOnlyTable>
- extends AbstractJavaJpaContextNode
- implements VirtualTable, JavaReadOnlyTable
-{
- protected final Owner owner;
-
- protected final T overriddenTable;
-
- protected String specifiedName;
- protected String defaultName;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected final ContextListContainer<JavaVirtualUniqueConstraint, ReadOnlyUniqueConstraint> uniqueConstraintContainer;
-
-
- protected AbstractJavaVirtualTable(JavaJpaContextNode parent, Owner owner, T overridenTable) {
- super(parent);
- this.owner = owner;
- this.overriddenTable = overridenTable;
- this.uniqueConstraintContainer = this.buildUniqueConstraintContainer();
- }
-
-
- // ********** 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 T getOverriddenTable() {
- return this.overriddenTable;
- }
-
-
- // ********** 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 ListIterable<JavaVirtualUniqueConstraint> getUniqueConstraints() {
- return this.uniqueConstraintContainer.getContextElements();
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraintContainer.getContextElementsSize();
- }
-
- public JavaVirtualUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraintContainer.getContextElement(index);
- }
-
- protected void updateUniqueConstraints() {
- this.uniqueConstraintContainer.update();
- }
-
- protected ListIterable<ReadOnlyUniqueConstraint> getOverriddenUniqueConstraints() {
- return new SuperListIterableWrapper<ReadOnlyUniqueConstraint>(this.getOverriddenTable().getUniqueConstraints());
- }
-
- protected void moveUniqueConstraint(int index, JavaVirtualUniqueConstraint constraint) {
- this.uniqueConstraintContainer.moveContextElement(index, constraint);
- }
-
- protected JavaVirtualUniqueConstraint addUniqueConstraint(int index, ReadOnlyUniqueConstraint uniqueConstraint) {
- return this.uniqueConstraintContainer.addContextElement(index, uniqueConstraint);
- }
-
- protected JavaVirtualUniqueConstraint buildUniqueConstraint(ReadOnlyUniqueConstraint uniqueConstraint) {
- return this.getJpaFactory().buildJavaVirtualUniqueConstraint(this, uniqueConstraint);
- }
-
- protected void removeUniqueConstraint(JavaVirtualUniqueConstraint constraint) {
- this.uniqueConstraintContainer.removeContextElement(constraint);
- }
-
- protected ContextListContainer<JavaVirtualUniqueConstraint, ReadOnlyUniqueConstraint> buildUniqueConstraintContainer() {
- return new UniqueConstraintContainer();
- }
-
- /**
- * unique constraint container
- */
- protected class UniqueConstraintContainer
- extends ContextListContainer<JavaVirtualUniqueConstraint, ReadOnlyUniqueConstraint>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return UNIQUE_CONSTRAINTS_LIST;
- }
- @Override
- protected JavaVirtualUniqueConstraint buildContextElement(ReadOnlyUniqueConstraint resourceElement) {
- return AbstractJavaVirtualTable.this.buildUniqueConstraint(resourceElement);
- }
- @Override
- protected ListIterable<ReadOnlyUniqueConstraint> getResourceElements() {
- return AbstractJavaVirtualTable.this.getOverriddenUniqueConstraints();
- }
- @Override
- protected ReadOnlyUniqueConstraint getResourceElement(JavaVirtualUniqueConstraint contextElement) {
- return contextElement.getOverriddenUniqueConstraint();
- }
- }
-
-
- // ********** database stuff **********
-
- public org.eclipse.jpt.jpa.db.Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
- 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);
- }
-
- /**
- * 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;
- }
-
- 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 **********
-
- @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.getParent().getValidationTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.buildQualifiedName());
- }
-
- protected String buildQualifiedName() {
- return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/DefaultJavaAttributeMappingDefinitionWrapper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/DefaultJavaAttributeMappingDefinitionWrapper.java
deleted file mode 100644
index 5c23c36ade..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/DefaultJavaAttributeMappingDefinitionWrapper.java
+++ /dev/null
@@ -1,29 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-
-public abstract class DefaultJavaAttributeMappingDefinitionWrapper
- extends JavaAttributeMappingDefinitionWrapper
- implements DefaultJavaAttributeMappingDefinition
-{
- protected DefaultJavaAttributeMappingDefinitionWrapper() {
- super();
- }
-
- @Override
- protected abstract DefaultJavaAttributeMappingDefinition getDelegate();
-
- public boolean isDefault(JavaPersistentAttribute persistentAttribute) {
- return this.getDelegate().isDefault(persistentAttribute);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/FieldAccessor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/FieldAccessor.java
deleted file mode 100644
index cfaffc8afd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/FieldAccessor.java
+++ /dev/null
@@ -1,108 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.PersistentFieldValidator;
-
-public class FieldAccessor
- extends AbstractAccessor
-{
- private final JavaResourceField resourceField;
-
- public FieldAccessor(ReadOnlyPersistentAttribute parent, JavaResourceField resourceField) {
- super(parent);
- this.resourceField = resourceField;
- }
-
- public JavaResourceAttribute getResourceAttribute() {
- return this.getField();
- }
-
- public JavaResourceField getField() {
- return this.resourceField;
- }
-
- public boolean isFor(JavaResourceField resourceField) {
- return this.resourceField == resourceField;
- }
-
- public boolean isFor(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) {
- return false;
- }
-
- public AccessType getDefaultAccess() {
- return AccessType.FIELD;
- }
-
- public boolean isPublic() {
- return this.resourceField.isPublic();
- }
-
- public boolean isFinal() {
- return this.resourceField.isFinal();
- }
-
- public JptValidator buildAttributeValidator(PersistentAttribute persistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) {
- return new PersistentFieldValidator(persistentAttribute, this, textRangeResolver);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getResourceAttribute().getNameTextRange(astRoot);
- }
-
- public JavaPersistentAttribute buildUnannotatedJavaAttribute(PersistentType parent) {
- return this.buildJavaAttribute(parent, this.buildUnannotatedJavaResourceField());
- }
-
- /**
- * Build a Java resource field that wraps the original Java resource
- * field and behaves as though it has no annotations. This will cause
- * all the settings in the Java <em>context</em> attribute to default.
- */
- protected JavaResourceField buildUnannotatedJavaResourceField() {
- return new UnannotatedJavaResourceField(this.getField());
- }
-
- protected JavaPersistentAttribute buildJavaAttribute(PersistentType parent, JavaResourceField resourceField) {
- return this.getJpaFactory().buildJavaPersistentField(parent, resourceField);
- }
-
-
- // ********** unannotated Java resource field **********
-
- /**
- * Wrap another Java resource field and suppress all its annotations.
- */
- protected class UnannotatedJavaResourceField
- extends UnannotatedJavaResourceAttribute<JavaResourceField>
- implements JavaResourceField
- {
- protected UnannotatedJavaResourceField(JavaResourceField field){
- super(field);
- }
-
- public Kind getKind() {
- return Kind.FIELD;
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
deleted file mode 100644
index 2e00357467..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
+++ /dev/null
@@ -1,277 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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.getJavaResourceType().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.getJavaResourceType().addAnnotation(this.getIdClassAnnotationName());
- }
-
- protected void removeIdClassAnnotationIfUnset() {
- if (this.getIdClassAnnotation().isUnset()) {
- this.removeIdClassAnnotation();
- }
- }
-
- protected void removeIdClassAnnotation() {
- this.getJavaResourceType().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() {
- JavaResourceType 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.getJavaResourceType() == resourceIdClass) {
- this.idClass.update();
- } else {
- this.idClass.dispose();
- this.setIdClass(this.buildIdClass(resourceIdClass));
- }
- }
- }
- }
-
- protected JavaResourceType resolveResourceIdClass() {
- if (this.fullyQualifiedIdClassName == null) {
- return null;
- }
- JavaResourceType jrt = this.getIdClassJavaResourceType();
- return (jrt == null) ? null : (jrt.isAnnotatedWith(getJpaProject().getTypeMappingAnnotations()) ? null : jrt);
- }
-
- protected JavaResourceType getIdClassJavaResourceType() {
- return (JavaResourceType) this.getJpaProject().getJavaResourceType(this.fullyQualifiedIdClassName, Kind.TYPE);
- }
- protected JavaPersistentType buildIdClass(JavaResourceType 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 JavaResourceType getJavaResourceType() {
- return this.getPersistentType().getJavaResourceType();
- }
-
-
- // ********** 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 **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateIdClass(messages, reporter, astRoot);
- }
-
- protected void validateIdClass(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- if (this.isSpecified()) {
- JavaResourceType jrt = this.getIdClassJavaResourceType();
- if ((jrt != null) && (jrt.isAnnotatedWith(getJpaProject().getTypeMappingAnnotations()))) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_ID_CLASS_NOT_VALID,
- new String[] {jrt.getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange(astRoot);
- }
-
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- IdClassAnnotation annotation = this.getIdClassAnnotation();
- return (annotation == null) ? null : annotation.getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java
deleted file mode 100644
index efbf688c40..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java
+++ /dev/null
@@ -1,199 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingMappedByRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaManyToManyRelationship
- extends AbstractJavaMappingRelationship<JavaManyToManyMapping>
- implements JavaManyToManyRelationship
-{
- protected final JavaMappingMappedByRelationshipStrategy2_0 mappedByStrategy;
-
- protected final JavaMappingJoinTableRelationshipStrategy2_0 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 JavaMappingRelationshipStrategy2_0 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 JavaMappingMappedByRelationshipStrategy2_0 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 JavaMappingJoinTableRelationshipStrategy2_0 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.mappedByStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- return this.joinTableStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.mappedByStrategy.validate(messages, reporter, astRoot);
- this.joinTableStrategy.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java
deleted file mode 100644
index d2a4bff421..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java
+++ /dev/null
@@ -1,195 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToOneRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingRelationshipStrategy2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaManyToOneRelationship
- extends AbstractJavaMappingRelationship<JavaManyToOneMapping>
- implements JavaManyToOneRelationship2_0
-{
- protected final JavaMappingJoinColumnRelationshipStrategy2_0 joinColumnStrategy;
-
- // JPA 2.0
- protected final JavaMappingJoinTableRelationshipStrategy2_0 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 JavaMappingRelationshipStrategy2_0 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 JavaMappingJoinTableRelationshipStrategy2_0 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 JavaMappingJoinColumnRelationshipStrategy2_0 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.joinColumnStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- return this.joinTableStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.joinColumnStrategy.validate(messages, reporter, astRoot);
- this.joinTableStrategy.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java
deleted file mode 100644
index 9189b3bfe6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java
+++ /dev/null
@@ -1,275 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationship;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingMappedByRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaMappedByRelationshipStrategy
- extends AbstractJavaJpaContextNode
- implements JavaMappingMappedByRelationshipStrategy2_0
-{
- 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 ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return null; // mapped-by strategies cannot be overridden
- }
-
- 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- OwnableRelationshipMappingAnnotation annotation = this.getMappingAnnotation();
- if ((annotation != null) && annotation.mappedByTouches(pos, astRoot)) {
- result = this.getJavaCandidateMappedByAttributeNames(filter);
- }
- return result;
- }
-
- public Iterable<String> getCandidateMappedByAttributeNames() {
- return this.getRelationshipMapping().getAllTargetEntityAttributeNames();
- }
-
- protected Iterable<String> getCandidateMappedByAttributeNames(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateMappedByAttributeNames(), filter);
- }
-
- protected Iterable<String> getJavaCandidateMappedByAttributeNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateMappedByAttributeNames(filter));
- }
-
-
- // ********** validation **********
-
- @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 = 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(astRoot)
- );
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getAnnotationMappedByTextRange(astRoot);
- return (textRange != null) ? textRange : this.getRelationship().getValidationTextRange(astRoot);
- }
-
- protected TextRange getAnnotationMappedByTextRange(CompilationUnit astRoot) {
- OwnableRelationshipMappingAnnotation annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getMappedByTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java
deleted file mode 100644
index d1e6577889..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-
-public class GenericJavaMappingJoinColumnRelationshipStrategy
- extends AbstractJavaJoinColumnRelationshipStrategy
- implements JavaMappingJoinColumnRelationshipStrategy2_0
-{
- 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 ListIterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
- return new SubListIterableWrapper<NestableAnnotation, JoinColumnAnnotation>(this.getNestableJoinColumnAnnotations());
- }
-
- protected ListIterable<NestableAnnotation> getNestableJoinColumnAnnotations() {
- return this.getResourceAttribute().getAnnotations(JoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected JoinColumnAnnotation addJoinColumnAnnotation(int index) {
- return (JoinColumnAnnotation) this.getResourceAttribute().addAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected void removeJoinColumnAnnotation(int index) {
- this.getResourceAttribute().removeAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected void moveJoinColumnAnnotation(int targetIndex, int sourceIndex) {
- this.getResourceAttribute().moveAnnotation(targetIndex, sourceIndex, JoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected JoinColumnAnnotation buildNullJoinColumnAnnotation() {
- return new NullJoinColumnAnnotation(this.getResourceAttribute());
- }
-
-
- // ********** misc **********
-
- protected JavaResourceAttribute getResourceAttribute() {
- return this.getRelationship().getMapping().getResourceAttribute();
- }
-
- @Override
- public JavaMappingJoinColumnRelationship getRelationship() {
- return (JavaMappingJoinColumnRelationship) super.getRelationship();
- }
-
- @Override
- protected JavaReadOnlyJoinColumn.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;
- }
-
- public ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return overrideRelationship.getJoinColumnStrategy();
- }
-
-
- // ********** 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 JavaReadOnlyJoinColumn.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();
- }
-
- protected 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 Iterable<String> getCandidateTableNames() {
- return GenericJavaMappingJoinColumnRelationshipStrategy.this.getCandidateTableNames();
- }
-
- 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 getJoinColumnsSize() {
- return GenericJavaMappingJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaMappingJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new JoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java
deleted file mode 100644
index e49cb1576d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java
+++ /dev/null
@@ -1,274 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingMappedByRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToManyRelationship2_0;
-import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaOneToManyRelationship
- extends AbstractJavaMappingRelationship<JavaOneToManyMapping>
- implements JavaOneToManyRelationship2_0
-{
- protected final JavaMappingMappedByRelationshipStrategy2_0 mappedByStrategy;
-
- protected final JavaMappingJoinTableRelationshipStrategy2_0 joinTableStrategy;
-
- // JPA 2.0 or EclipseLink
- protected final boolean supportsJoinColumnStrategy;
- protected final JavaMappingJoinColumnRelationshipStrategy2_0 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 JavaMappingRelationshipStrategy2_0 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 JavaMappingMappedByRelationshipStrategy2_0 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 JavaMappingJoinTableRelationshipStrategy2_0 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 JavaMappingJoinColumnRelationshipStrategy2_0 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.mappedByStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.joinTableStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- return this.joinColumnStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.mappedByStrategy.validate(messages, reporter, astRoot);
- this.joinTableStrategy.validate(messages, reporter, astRoot);
- this.joinColumnStrategy.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
deleted file mode 100644
index c0335f4611..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java
+++ /dev/null
@@ -1,303 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingMappedByRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingPrimaryKeyJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToOneRelationship2_0;
-import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaOneToOneRelationship
- extends AbstractJavaMappingRelationship<JavaOneToOneMapping>
- implements JavaOneToOneRelationship2_0
-{
- protected final JavaMappingMappedByRelationshipStrategy2_0 mappedByStrategy;
-
- protected final JavaMappingPrimaryKeyJoinColumnRelationshipStrategy2_0 primaryKeyJoinColumnStrategy;
-
- // JPA 2.0
- protected final JavaMappingJoinTableRelationshipStrategy2_0 joinTableStrategy;
-
- protected final JavaMappingJoinColumnRelationshipStrategy2_0 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 JavaMappingRelationshipStrategy2_0 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 JavaMappingMappedByRelationshipStrategy2_0 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 JavaMappingPrimaryKeyJoinColumnRelationshipStrategy2_0 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 JavaMappingJoinTableRelationshipStrategy2_0 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.getPrimaryKeyJoinColumnsSize() == 0) &&
- (this.joinTableStrategy.getJoinTable() == null);
- }
-
- protected JavaMappingJoinColumnRelationshipStrategy2_0 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.mappedByStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.primaryKeyJoinColumnStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.joinTableStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- return this.joinColumnStrategy.getJavaCompletionProposals(pos, filter, astRoot);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.mappedByStrategy.validate(messages, reporter, astRoot);
- this.primaryKeyJoinColumnStrategy.validate(messages, reporter, astRoot);
- this.joinColumnStrategy.validate(messages, reporter, astRoot);
- this.joinTableStrategy.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 9f2506df95..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,232 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-
-public class GenericJavaOverrideJoinColumnRelationshipStrategy
- extends AbstractJavaJoinColumnRelationshipStrategy
-{
- public GenericJavaOverrideJoinColumnRelationshipStrategy(JavaOverrideRelationship parent) {
- super(parent);
- }
-
-
- // ********** join column annotations **********
-
- @Override
- protected ListIterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
- return this.getOverrideAnnotation().getJoinColumns();
- }
-
- @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.getRelationship().getOverrideAnnotation();
- }
-
-
- // ********** misc **********
-
- @Override
- protected JavaReadOnlyJoinColumn.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.getRelationship().getTypeMapping();
- }
-
- public TypeMapping getRelationshipTarget() {
- return this.isTargetForeignKey() ?
- this.getRelationship().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.getRelationship().getMapping();
- }
-
- protected String getAttributeName() {
- return this.getRelationship().getAttributeName();
- }
-
- @Override
- public String getTableName() {
- return this.isTargetForeignKey() ?
- super.getTableName() :
- this.getRelationship().getDefaultTableName();
- }
-
- @Override
- public Table resolveDbTable(String tableName) {
- return this.isTargetForeignKey() ?
- super.resolveDbTable(tableName) :
- this.getRelationship().resolveDbTable(tableName);
- }
-
- @Override
- public boolean tableNameIsInvalid(String tableName) {
- return this.isTargetForeignKey() ?
- super.tableNameIsInvalid(tableName) :
- this.getRelationship().tableNameIsInvalid(tableName);
- }
-
- @Override
- public Iterable<String> getCandidateTableNames() {
- return this.isTargetForeignKey() ?
- super.getCandidateTableNames() :
- this.getRelationship().getCandidateTableNames();
- }
-
- public String getColumnTableNotValidDescription() {
- return null;
- }
-
- public boolean isOverridable() {
- return false;
- }
-
- @Override
- public JavaOverrideRelationship getRelationship() {
- return (JavaOverrideRelationship) super.getRelationship();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationship().getValidationTextRange(astRoot);
- }
-
-
- // ********** join column owner adapter **********
-
- protected class JoinColumnOwner
- implements JavaReadOnlyJoinColumn.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 Iterable<String> getCandidateTableNames() {
- return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getCandidateTableNames();
- }
-
- 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 getJoinColumnsSize() {
- return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getRelationship().buildColumnValidator((ReadOnlyBaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
deleted file mode 100644
index c7906299ff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,351 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingPrimaryKeyJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy
- extends AbstractJavaJpaContextNode
- implements JavaMappingPrimaryKeyJoinColumnRelationshipStrategy2_0
-{
- protected final ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation> primaryKeyJoinColumnContainer;
- protected final JavaReadOnlyJoinColumn.Owner primaryKeyJoinColumnOwner;
-
-
- public GenericJavaPrimaryKeyJoinColumnRelationshipStrategy(JavaPrimaryKeyJoinColumnRelationship parent) {
- super(parent);
- this.primaryKeyJoinColumnContainer = this.buildPrimaryKeyJoinColumnContainer();
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncPrimaryKeyJoinColumns();
- }
-
- @Override
- public void update() {
- super.update();
- this.updatePrimaryKeyJoinColumns();
- }
-
-
- // ********** primary key join columns **********
-
- public ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.primaryKeyJoinColumnContainer.getContextElements();
- }
-
- public int getPrimaryKeyJoinColumnsSize() {
- return this.primaryKeyJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasPrimaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumnsSize() != 0;
- }
-
- public JavaPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
- return this.primaryKeyJoinColumnContainer.getContextElement(index);
- }
-
- public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn() {
- return this.addPrimaryKeyJoinColumn(this.getPrimaryKeyJoinColumnsSize());
- }
-
- public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) {
- PrimaryKeyJoinColumnAnnotation annotation = this.addPrimaryKeyJoinColumnAnnotation(index);
- return this.primaryKeyJoinColumnContainer.addContextElement(index, annotation);
- }
-
- public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumnContainer.indexOfContextElement((JavaPrimaryKeyJoinColumn) joinColumn));
- }
-
- public void removePrimaryKeyJoinColumn(int index) {
- this.removePrimaryKeyJoinColumnAnnotation(index);
- this.primaryKeyJoinColumnContainer.removeContextElement(index);
- }
-
- public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.movePrimaryKeyJoinColumnAnnotation(targetIndex, sourceIndex);
- this.primaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected void syncPrimaryKeyJoinColumns() {
- this.primaryKeyJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected void updatePrimaryKeyJoinColumns() {
- this.primaryKeyJoinColumnContainer.update();
- }
-
- protected ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation> buildPrimaryKeyJoinColumnContainer() {
- return new PrimaryKeyJoinColumnContainer();
- }
-
- /**
- * primary key join column container
- */
- protected class PrimaryKeyJoinColumnContainer
- extends ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return PRIMARY_KEY_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaPrimaryKeyJoinColumn buildContextElement(PrimaryKeyJoinColumnAnnotation resourceElement) {
- return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.buildPrimaryKeyJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
- return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumnAnnotations();
- }
- @Override
- protected PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
- return contextElement.getColumnAnnotation();
- }
- }
-
- protected JavaReadOnlyJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation annotation) {
- return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, annotation);
- }
-
-
- // ********** primary key join column annotations **********
-
- protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
- return new SubListIterableWrapper<NestableAnnotation, PrimaryKeyJoinColumnAnnotation>(this.getNestablePrimaryKeyJoinColumnAnnotations());
- }
-
- protected ListIterable<NestableAnnotation> getNestablePrimaryKeyJoinColumnAnnotations() {
- return this.getResourceAttribute().getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- protected PrimaryKeyJoinColumnAnnotation addPrimaryKeyJoinColumnAnnotation(int index) {
- return (PrimaryKeyJoinColumnAnnotation) this.getResourceAttribute().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- protected void removePrimaryKeyJoinColumnAnnotation(int index) {
- this.getResourceAttribute().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
- }
-
- protected void movePrimaryKeyJoinColumnAnnotation(int targetIndex, int sourceIndex) {
- this.getResourceAttribute().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnAnnotation.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 JavaResourceAttribute getResourceAttribute() {
- return this.getRelationship().getMapping().getResourceAttribute();
- }
-
- 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 ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return null; // pk join column strategies cannot be overridden
- }
-
- public void addStrategy() {
- if (this.getPrimaryKeyJoinColumnsSize() == 0) {
- this.addPrimaryKeyJoinColumn();
- }
- }
-
- public void removeStrategy() {
- for (int i = this.getPrimaryKeyJoinColumnsSize(); i-- > 0; ) {
- this.removePrimaryKeyJoinColumn(i);
- }
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaPrimaryKeyJoinColumn column : this.getPrimaryKeyJoinColumns()) {
- result = column.getJavaCompletionProposals(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 JavaReadOnlyJoinColumn.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();
- }
-
- protected 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 Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- 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 getJoinColumnsSize() {
- return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new OneToOnePrimaryKeyJoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
- }
-
- protected JavaRelationshipMapping getRelationshipMapping() {
- return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getRelationshipMapping();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java
deleted file mode 100644
index be5755ae9d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java
+++ /dev/null
@@ -1,377 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java virtual join table
- */
-public class GenericJavaVirtualJoinTable
- extends AbstractJavaVirtualReferenceTable<ReadOnlyJoinTable>
- implements JavaVirtualJoinTable
-{
-
- protected final ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn> specifiedInverseJoinColumnContainer;
- protected final JavaReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
-
- protected JavaVirtualJoinColumn defaultInverseJoinColumn;
-
-
- public GenericJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, Owner owner, ReadOnlyJoinTable overriddenTable) {
- super(parent, owner, overriddenTable);
- this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- this.specifiedInverseJoinColumnContainer = this.buildSpecifiedInverseJoinColumnContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedInverseJoinColumns();
- this.updateDefaultInverseJoinColumn();
- }
-
-
- // ********** inverse join columns **********
-
- public ListIterable<JavaVirtualJoinColumn> getInverseJoinColumns() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
- }
-
- public int getInverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
- }
-
-
- // ********** inverse specified join columns **********
-
- public ListIterable<JavaVirtualJoinColumn> getSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumnsSize() != 0;
- }
-
- public JavaVirtualJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumnContainer.getContextElement(index);
- }
-
- protected void updateSpecifiedInverseJoinColumns() {
- this.specifiedInverseJoinColumnContainer.update();
- }
-
- protected ListIterable<ReadOnlyJoinColumn> getOverriddenInverseJoinColumns() {
- return new SuperListIterableWrapper<ReadOnlyJoinColumn>(this.getOverriddenTable().getSpecifiedInverseJoinColumns());
- }
-
- protected void moveSpecifiedInverseJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
- this.specifiedInverseJoinColumnContainer.moveContextElement(index, joinColumn);
- }
-
- protected JavaVirtualJoinColumn addSpecifiedInverseJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- return this.specifiedInverseJoinColumnContainer.addContextElement(index, joinColumn);
- }
-
- protected void removeSpecifiedInverseJoinColumn(JavaVirtualJoinColumn joinColumn) {
- this.specifiedInverseJoinColumnContainer.removeContextElement(joinColumn);
- }
-
- protected ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedInverseJoinColumnContainer() {
- return new SpecifiedInverseJoinColumnContainer();
- }
-
- /**
- * specified join column container
- */
- protected class SpecifiedInverseJoinColumnContainer
- extends ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_INVERSE_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
- return GenericJavaVirtualJoinTable.this.buildInverseJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
- return GenericJavaVirtualJoinTable.this.getOverriddenInverseJoinColumns();
- }
- @Override
- protected ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
- return contextElement.getOverriddenColumn();
- }
- }
-
-
- // ********** 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 getRelationshipStrategy() {
- return this.getParent();
- }
-
- @Override
- protected JavaReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- protected JavaReadOnlyJoinColumn.Owner buildInverseJoinColumnOwner() {
- return new InverseJoinColumnOwner();
- }
-
- protected JavaVirtualJoinColumn buildInverseJoinColumn(ReadOnlyJoinColumn joinColumn) {
- return this.buildJoinColumn(this.inverseJoinColumnOwner, joinColumn);
- }
-
- @Override
- protected String buildDefaultName() {
- return this.getRelationshipStrategy().getJoinTableDefaultName();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getRelationshipStrategy().getRelationship().getMapping();
- }
-
- public PersistentAttribute getPersistentAttribute() {
- return this.getRelationshipMapping().getPersistentAttribute();
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateJoinColumns(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validateJoinColumns(messages, reporter, astRoot);
- this.validateNodes(this.getInverseJoinColumns(), messages, reporter, astRoot);
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationshipStrategy().validatesAgainstDatabase();
- }
-
-
- // ********** join column owners **********
-
- /**
- * just a little common behavior
- */
- protected abstract class AbstractJoinColumnOwner
- implements JavaReadOnlyJoinColumn.Owner
- {
- protected AbstractJoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getRelationship().getTypeMapping();
- }
-
- /**
- * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
- */
- public String getDefaultColumnName() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * If there is a specified table name it needs to be the same
- * the default table name. The table is always the join table.
- */
- public boolean tableNameIsInvalid(String tableName) {
- return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
- }
-
- /**
- * the join column can only be on the join table itself
- */
- public Iterable<String> getCandidateTableNames() {
- return EmptyIterable.instance();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return Tools.valuesAreEqual(GenericJavaVirtualJoinTable.this.getName(), tableName) ?
- GenericJavaVirtualJoinTable.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 GenericJavaVirtualJoinTable.this.getName();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaVirtualJoinTable.this.getValidationTextRange(astRoot);
- }
-
- protected JavaVirtualRelationship getRelationship() {
- return GenericJavaVirtualJoinTable.this.getRelationshipStrategy().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 org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericJavaVirtualJoinTable.this.defaultJoinColumn == joinColumn;
- }
-
- public int getJoinColumnsSize() {
- return GenericJavaVirtualJoinTable.this.getJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return GenericJavaVirtualJoinTable.this.getRelationshipStrategy().buildJoinTableJoinColumnValidator((ReadOnlyJoinColumn) 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 = GenericJavaVirtualJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- RelationshipMapping relationshipMapping = GenericJavaVirtualJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getName();
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- Entity relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericJavaVirtualJoinTable.this.defaultInverseJoinColumn == joinColumn;
- }
-
- public int getJoinColumnsSize() {
- return GenericJavaVirtualJoinTable.this.getInverseJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return GenericJavaVirtualJoinTable.this.getRelationshipStrategy().buildJoinTableInverseJoinColumnValidator((ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaAttributeMappingDefinitionWrapper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaAttributeMappingDefinitionWrapper.java
deleted file mode 100644
index 7f038b7ecf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaAttributeMappingDefinitionWrapper.java
+++ /dev/null
@@ -1,55 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-
-/**
- * Simplify delegation to another definition.
- * A subclass need only implement {@link #getDelegate()} and override the
- * appropriate method(s).
- */
-public abstract class JavaAttributeMappingDefinitionWrapper
- implements JavaAttributeMappingDefinition
-{
- protected JavaAttributeMappingDefinitionWrapper() {
- super();
- }
-
- protected abstract JavaAttributeMappingDefinition getDelegate();
-
- public String getKey() {
- return this.getDelegate().getKey();
- }
-
- public String getAnnotationName() {
- return this.getDelegate().getAnnotationName();
- }
-
- public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return this.getDelegate().isSpecified(persistentAttribute);
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return this.getDelegate().getSupportingAnnotationNames();
- }
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return this.getDelegate().buildMapping(persistentAttribute, factory);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java
deleted file mode 100644
index d1ae9869c9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java
+++ /dev/null
@@ -1,28 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-
-public class JavaBaseColumnTextRangeResolver
- extends AbstractJavaNamedColumnTextRangeResolver<JavaReadOnlyBaseColumn>
- implements BaseColumnTextRangeResolver
-{
- public JavaBaseColumnTextRangeResolver(JavaReadOnlyBaseColumn column, CompilationUnit astRoot) {
- super(column, astRoot);
- }
-
- public TextRange getTableTextRange() {
- return this.column.getTableTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java
deleted file mode 100644
index a858697319..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java
+++ /dev/null
@@ -1,81 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-
-public class JavaBasicMappingDefinition
- implements DefaultJavaAttributeMappingDefinition
-{
- // singleton
- private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaBasicMappingDefinition();
-
- /**
- * Return the singleton.
- */
- public static DefaultJavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaBasicMappingDefinition() {
- super();
- }
-
- public String getKey() {
- return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return BasicAnnotation.ANNOTATION_NAME;
- }
-
- public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- ColumnAnnotation.ANNOTATION_NAME,
- LobAnnotation.ANNOTATION_NAME,
- TemporalAnnotation.ANNOTATION_NAME,
- EnumeratedAnnotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaBasicMapping(persistentAttribute);
- }
-
- public boolean isDefault(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.typeIsBasic();
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java
deleted file mode 100644
index 15b9f51048..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-
-public class JavaEmbeddableDefinition
- implements JavaTypeMappingDefinition
-{
- // singleton
- private static final JavaEmbeddableDefinition INSTANCE = new JavaEmbeddableDefinition();
-
- /**
- * Return the singleton
- */
- public static JavaTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaEmbeddableDefinition() {
- super();
- }
-
- public String getKey() {
- return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return EmbeddableAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return EmptyIterable.instance();
- }
-
- public JavaEmbeddable buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) {
- return factory.buildJavaEmbeddable(persistentType, (EmbeddableAnnotation) mappingAnnotation);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
deleted file mode 100644
index 27d7523752..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java
+++ /dev/null
@@ -1,73 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-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.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- AttributeOverrideAnnotation.ANNOTATION_NAME,
- JPA.ATTRIBUTE_OVERRIDES,
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaEmbeddedIdMapping(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java
deleted file mode 100644
index 5d4a57193a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java
+++ /dev/null
@@ -1,77 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-public class JavaEmbeddedMappingDefinition
- implements DefaultJavaAttributeMappingDefinition
-{
- // singleton
- private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEmbeddedMappingDefinition();
-
- /**
- * Return the singleton.
- */
- public static DefaultJavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaEmbeddedMappingDefinition() {
- super();
- }
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return EmbeddedAnnotation.ANNOTATION_NAME;
- }
-
- public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- AttributeOverrideAnnotation.ANNOTATION_NAME,
- JPA.ATTRIBUTE_OVERRIDES,
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaEmbeddedMapping(persistentAttribute);
- }
-
- public boolean isDefault(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getEmbeddable() != null;
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java
deleted file mode 100644
index 264faad066..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java
+++ /dev/null
@@ -1,110 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
-
-public class JavaEntityDefinition
- implements JavaTypeMappingDefinition
-{
- // singleton
- private static final JavaEntityDefinition INSTANCE = new JavaEntityDefinition();
-
- /**
- * Return the singleton
- */
- public static JavaTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaEntityDefinition() {
- super();
- }
-
- public String getKey() {
- return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return EntityAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- TableAnnotation.ANNOTATION_NAME,
- SecondaryTableAnnotation.ANNOTATION_NAME,
- JPA.SECONDARY_TABLES,
- PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- JPA.PRIMARY_KEY_JOIN_COLUMNS,
- IdClassAnnotation.ANNOTATION_NAME,
- InheritanceAnnotation.ANNOTATION_NAME,
- DiscriminatorValueAnnotation.ANNOTATION_NAME,
- DiscriminatorColumnAnnotation.ANNOTATION_NAME,
- SequenceGeneratorAnnotation.ANNOTATION_NAME,
- TableGeneratorAnnotation.ANNOTATION_NAME,
- NamedQueryAnnotation.ANNOTATION_NAME,
- JPA.NAMED_QUERIES,
- NamedNativeQueryAnnotation.ANNOTATION_NAME,
- JPA.NAMED_NATIVE_QUERIES,
- JPA.SQL_RESULT_SET_MAPPING,
- JPA.EXCLUDE_DEFAULT_LISTENERS,
- JPA.EXCLUDE_SUPERCLASS_LISTENERS,
- JPA.ENTITY_LISTENERS,
- JPA.PRE_PERSIST,
- JPA.POST_PERSIST,
- JPA.PRE_REMOVE,
- JPA.POST_REMOVE,
- JPA.PRE_UPDATE,
- JPA.POST_UPDATE,
- JPA.POST_LOAD,
- AttributeOverrideAnnotation.ANNOTATION_NAME,
- JPA.ATTRIBUTE_OVERRIDES,
- AssociationOverrideAnnotation.ANNOTATION_NAME,
- JPA.ASSOCIATION_OVERRIDES
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaEntity buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) {
- return factory.buildJavaEntity(persistentType, (EntityAnnotation) mappingAnnotation);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java
deleted file mode 100644
index af74224308..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
-
-public class JavaEntityTextRangeResolver
- implements EntityTextRangeResolver
-{
- private JavaEntity entity;
-
- private CompilationUnit astRoot;
-
-
- public JavaEntityTextRangeResolver(JavaEntity entity, CompilationUnit astRoot) {
- this.entity = entity;
- this.astRoot = astRoot;
- }
-
-
- public TextRange getTypeMappingTextRange() {
- return this.entity.getValidationTextRange(this.astRoot);
- }
-
- public TextRange getIdClassTextRange() {
- return this.entity.getIdClassReference().getValidationTextRange(this.astRoot);
- }
-
- public TextRange getAttributeMappingTextRange(String attributeName) {
- return this.entity.getPersistentType().
- getAttributeNamed(attributeName).getMapping().getValidationTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java
deleted file mode 100644
index 24c22ab227..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java
+++ /dev/null
@@ -1,79 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-
-public class JavaIdMappingDefinition
- implements JavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaIdMappingDefinition();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaIdMappingDefinition() {
- super();
- }
-
- public String getKey() {
- return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return IdAnnotation.ANNOTATION_NAME;
- }
-
- public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- ColumnAnnotation.ANNOTATION_NAME,
- GeneratedValueAnnotation.ANNOTATION_NAME,
- TemporalAnnotation.ANNOTATION_NAME,
- TableGeneratorAnnotation.ANNOTATION_NAME,
- SequenceGeneratorAnnotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaIdMapping(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java
deleted file mode 100644
index 5d1f33cb37..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,32 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-
-public class JavaJoinColumnTextRangeResolver
- extends AbstractJavaNamedColumnTextRangeResolver<JavaReadOnlyJoinColumn>
- implements JoinColumnTextRangeResolver
-{
- public JavaJoinColumnTextRangeResolver(JavaReadOnlyJoinColumn column, CompilationUnit astRoot) {
- super(column, astRoot);
- }
-
- public TextRange getTableTextRange() {
- return this.column.getTableTextRange(this.astRoot);
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.column.getReferencedColumnNameTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java
deleted file mode 100644
index e430c5f21b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java
+++ /dev/null
@@ -1,75 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
-
-public class JavaManyToManyMappingDefinition
- implements JavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToManyMappingDefinition();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaManyToManyMappingDefinition() {
- 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.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- JoinTableAnnotation.ANNOTATION_NAME,
- MapKeyAnnotation.ANNOTATION_NAME,
- OrderByAnnotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaManyToManyMapping(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java
deleted file mode 100644
index 316e2747e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java
+++ /dev/null
@@ -1,75 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
-
-public class JavaManyToOneMappingDefinition
- implements JavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToOneMappingDefinition();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaManyToOneMappingDefinition() {
- 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.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- JoinTableAnnotation.ANNOTATION_NAME,
- JoinColumnAnnotation.ANNOTATION_NAME,
- JPA.JOIN_COLUMNS
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaManyToOneMapping(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java
deleted file mode 100644
index fc00d7bedd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java
+++ /dev/null
@@ -1,79 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
-
-public class JavaMappedSuperclassDefinition
- implements JavaTypeMappingDefinition
-{
- // singleton
- private static final JavaMappedSuperclassDefinition INSTANCE = new JavaMappedSuperclassDefinition();
-
- /**
- * Return the singleton
- */
- public static JavaTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaMappedSuperclassDefinition() {
- super();
- }
-
- public String getKey() {
- return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return MappedSuperclassAnnotation.ANNOTATION_NAME;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private 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
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaMappedSuperclass buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) {
- return factory.buildJavaMappedSuperclass(persistentType, (MappedSuperclassAnnotation) mappingAnnotation);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java
deleted file mode 100644
index c9319716ea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-
-public class JavaMappedSuperclassTextRangeResolver
- implements PrimaryKeyTextRangeResolver
-{
- private JavaMappedSuperclass mappedSuperclass;
-
- private CompilationUnit astRoot;
-
-
- public JavaMappedSuperclassTextRangeResolver(
- JavaMappedSuperclass mappedSuperclass, CompilationUnit astRoot) {
-
- this.mappedSuperclass = mappedSuperclass;
- this.astRoot = astRoot;
- }
-
-
- public TextRange getTypeMappingTextRange() {
- return this.mappedSuperclass.getValidationTextRange(this.astRoot);
- }
-
- public TextRange getIdClassTextRange() {
- return this.mappedSuperclass.getIdClassReference().getValidationTextRange(this.astRoot);
- }
-
- public TextRange getAttributeMappingTextRange(String attributeName) {
- return this.mappedSuperclass.getPersistentType().
- getAttributeNamed(attributeName).getMapping().getValidationTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java
deleted file mode 100644
index 6dbf8d9884..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java
+++ /dev/null
@@ -1,21 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
-
-public class JavaNamedColumnTextRangeResolver
- extends AbstractJavaNamedColumnTextRangeResolver<JavaReadOnlyNamedColumn>
-{
- public JavaNamedColumnTextRangeResolver(JavaReadOnlyNamedColumn column, CompilationUnit astRoot) {
- super(column, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java
deleted file mode 100644
index b6f1f6cfc6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java
+++ /dev/null
@@ -1,83 +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.jpa.core.internal.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java null type mapping
- */
-public class JavaNullTypeMapping
- extends AbstractJavaTypeMapping<Annotation>
-{
- public JavaNullTypeMapping(JavaPersistentType parent) {
- super(parent, null);
- }
-
- public String getKey() {
- return MappingKeys.NULL_TYPE_MAPPING_KEY;
- }
-
- public JavaPersistentType getIdClass() {
- return null;
- }
-
- public boolean isMapped() {
- return false;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
-
- // ********** validation **********
-
- /**
- * We added this message here because the most likely solution is to add
- * an annotation to the .java file.
- * This message used to be found on the <class> tag in persistence.xml.
- * The other possible way to fix the error is to remove it from persistence.xml.
- * This can be accomplished with the Synchronize Classes action.
- * We could also add a quick fix for this error.
- */
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_INVALID_CLASS,
- new String[] {this.getPersistentType().getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
-
- @Override
- public boolean validatesAgainstDatabase() {
- return false;
- }
-
- @Override
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getPersistentType().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java
deleted file mode 100644
index e5562683b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java
+++ /dev/null
@@ -1,79 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
-
-public class JavaOneToManyMappingDefinition
- implements JavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToManyMappingDefinition();
-
- /**
- * Return the singleton
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaOneToManyMappingDefinition() {
- 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.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- JoinTableAnnotation.ANNOTATION_NAME,
- MapKeyAnnotation.ANNOTATION_NAME,
- OrderByAnnotation.ANNOTATION_NAME,
- JoinColumnAnnotation.ANNOTATION_NAME,
- JPA.JOIN_COLUMNS
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaOneToManyMapping(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java
deleted file mode 100644
index 849d052ba5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java
+++ /dev/null
@@ -1,78 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-
-public class JavaOneToOneMappingDefinition
- implements JavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToOneMappingDefinition();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaOneToOneMappingDefinition() {
- 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.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- JoinTableAnnotation.ANNOTATION_NAME,
- JoinColumnAnnotation.ANNOTATION_NAME,
- JPA.JOIN_COLUMNS,
- PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME,
- JPA.PRIMARY_KEY_JOIN_COLUMNS
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaOneToOneMapping(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java
deleted file mode 100644
index cc39280cb8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java
+++ /dev/null
@@ -1,32 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-
-public class JavaOverrideTextRangeResolver
- implements OverrideTextRangeResolver
-{
- protected final JavaReadOnlyOverride javaOverride;
-
- protected final CompilationUnit astRoot;
-
- public JavaOverrideTextRangeResolver(JavaReadOnlyOverride javaOverride, CompilationUnit astRoot) {
- this.javaOverride = javaOverride;
- this.astRoot = astRoot;
- }
-
- public TextRange getNameTextRange() {
- return this.javaOverride.getNameTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java
deleted file mode 100644
index 83fe6f95ca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-
-public class JavaPersistentAttributeTextRangeResolver
- implements PersistentAttributeTextRangeResolver
-{
- private JavaPersistentAttribute javaPersistentAttribute;
-
- private CompilationUnit astRoot;
-
- public JavaPersistentAttributeTextRangeResolver(JavaPersistentAttribute javaPersistentAttribute, CompilationUnit astRoot) {
- this.javaPersistentAttribute = javaPersistentAttribute;
- this.astRoot = astRoot;
- }
-
- public TextRange getAttributeTextRange() {
- return this.javaPersistentAttribute.getValidationTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java
deleted file mode 100644
index 5c48c75400..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-
-public class JavaPrimaryKeyJoinColumnTextRangeResolver
- extends AbstractJavaNamedColumnTextRangeResolver<JavaPrimaryKeyJoinColumn>
- implements BaseJoinColumnTextRangeResolver
-{
-
- public JavaPrimaryKeyJoinColumnTextRangeResolver(JavaPrimaryKeyJoinColumn column, CompilationUnit astRoot) {
- super(column, astRoot);
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.column.getReferencedColumnNameTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java
deleted file mode 100644
index 8d42bc6983..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java
+++ /dev/null
@@ -1,42 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyTable;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-
-public class JavaTableTextRangeResolver
- implements TableTextRangeResolver
-{
- protected final JavaReadOnlyTable table;
-
- protected final CompilationUnit astRoot;
-
-
- public JavaTableTextRangeResolver(JavaReadOnlyTable table, CompilationUnit astRoot) {
- super();
- this.table = table;
- this.astRoot = astRoot;
- }
-
- public TextRange getNameTextRange() {
- return this.table.getNameTextRange(this.astRoot);
- }
-
- public TextRange getCatalogTextRange() {
- return this.table.getCatalogTextRange(this.astRoot);
- }
-
- public TextRange getSchemaTextRange() {
- return this.table.getSchemaTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java
deleted file mode 100644
index ca1fcc602d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java
+++ /dev/null
@@ -1,65 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
-
-public class JavaTransientMappingDefinition
- implements JavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaTransientMappingDefinition();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaTransientMappingDefinition() {
- super();
- }
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return TransientAnnotation.ANNOTATION_NAME;
- }
-
- public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return EmptyIterable.instance();
- }
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaTransientMapping(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingDefinitionWrapper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingDefinitionWrapper.java
deleted file mode 100644
index 9d40e1ede0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingDefinitionWrapper.java
+++ /dev/null
@@ -1,52 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-
-/**
- * Simplify delegation to another definition.
- * A subclass need only implement {@link #getDelegate()} and override the
- * appropriate method(s).
- */
-public abstract class JavaTypeMappingDefinitionWrapper
- implements JavaTypeMappingDefinition
-{
- protected JavaTypeMappingDefinitionWrapper() {
- super();
- }
-
- protected abstract JavaTypeMappingDefinition getDelegate();
-
- public String getKey() {
- return this.getDelegate().getKey();
- }
-
- public String getAnnotationName() {
- return this.getDelegate().getAnnotationName();
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return this.getDelegate().getSupportingAnnotationNames();
- }
-
- public JavaTypeMapping buildMapping(JavaPersistentType persistentType, Annotation annotation, JpaFactory factory) {
- return this.getDelegate().buildMapping(persistentType, annotation, factory);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java
deleted file mode 100644
index 174e6b2b7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
-
-public class JavaTypeMappingTextRangeResolver
- implements TypeMappingTextRangeResolver
-{
- private JavaTypeMapping typeMapping;
-
- private CompilationUnit astRoot;
-
- public JavaTypeMappingTextRangeResolver(JavaTypeMapping typeMapping, CompilationUnit astRoot) {
- this.typeMapping = typeMapping;
- this.astRoot = astRoot;
- }
-
- public TextRange getTypeMappingTextRange() {
- return this.typeMapping.getValidationTextRange(this.astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java
deleted file mode 100644
index fde7b35990..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java
+++ /dev/null
@@ -1,73 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
-
-public class JavaVersionMappingDefinition
- implements JavaAttributeMappingDefinition
-{
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaVersionMappingDefinition();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaVersionMappingDefinition() {
- super();
- }
-
- public String getKey() {
- return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public String getAnnotationName() {
- return VersionAnnotation.ANNOTATION_NAME;
- }
-
- public boolean isSpecified(JavaPersistentAttribute persistentAttribute) {
- return persistentAttribute.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- ColumnAnnotation.ANNOTATION_NAME,
- TemporalAnnotation.ANNOTATION_NAME,
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return factory.buildJavaVersionMapping(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PropertyAccessor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PropertyAccessor.java
deleted file mode 100644
index b8b58c3ffb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/PropertyAccessor.java
+++ /dev/null
@@ -1,139 +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.jpa.core.internal.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.MethodSignature;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.PersistentPropertyValidator;
-
-public class PropertyAccessor
- extends AbstractAccessor
-{
- private final JavaResourceMethod resourceGetter;
-
- private final JavaResourceMethod resourceSetter;
-
- public PropertyAccessor(ReadOnlyPersistentAttribute parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
- super(parent);
- this.resourceGetter = resourceGetter;
- this.resourceSetter = resourceSetter;
- }
-
- public JavaResourceAttribute getResourceAttribute() {
- return this.resourceGetter;
- }
-
- public boolean isFor(JavaResourceField resourceField) {
- return false;
- }
-
- public boolean isFor(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) {
- return (this.resourceGetter == getterMethod) && (this.resourceSetter == setterMethod);
- }
-
- public AccessType getDefaultAccess() {
- return AccessType.PROPERTY;
- }
-
- public JavaResourceMethod getResourceGetter() {
- return this.resourceGetter;
- }
-
- public JavaResourceMethod getResourceSetter() {
- return this.resourceSetter;
- }
-
- public JavaPersistentAttribute buildUnannotatedJavaAttribute(PersistentType parent) {
- return this.buildJavaAttribute(parent, this.buildUnannotatedJavaResourceGetter(), this.buildUnannotatedJavaResourceSetter());
- }
-
- /**
- * Build a Java resource method that wraps the original Java resource
- * getter method and behaves as though it has no annotations. This will cause
- * all the settings in the Java <em>context</em> attribute to default.
- */
- protected JavaResourceMethod buildUnannotatedJavaResourceGetter() {
- return new UnannotatedJavaResourceMethod(this.getResourceGetter());
- }
-
- /**
- * Build a Java resource method that wraps the original Java resource
- * setter method and behaves as though it has no annotations. This will cause
- * all the settings in the Java <em>context</em> attribute to default.
- */
- protected JavaResourceMethod buildUnannotatedJavaResourceSetter() {
- return new UnannotatedJavaResourceMethod(this.getResourceSetter());
- }
-
- protected JavaPersistentAttribute buildJavaAttribute(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
- return this.getJpaFactory().buildJavaPersistentProperty(parent, resourceGetter, resourceSetter);
- }
-
-
- public JptValidator buildAttributeValidator(PersistentAttribute persistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) {
- return new PersistentPropertyValidator(persistentAttribute, this, textRangeResolver);
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getResourceAttribute().getNameTextRange(astRoot);
- }
-
-
- // ********** unannotated Java resource method **********
-
- /**
- * Wrap another Java resource method and suppress all its annotations.
- */
- protected class UnannotatedJavaResourceMethod
- extends UnannotatedJavaResourceAttribute<JavaResourceMethod>
- implements JavaResourceMethod
- {
- protected UnannotatedJavaResourceMethod(JavaResourceMethod method){
- super(method);
- }
-
- public Kind getKind() {
- return Kind.METHOD;
- }
-
- public String getMethodName() {
- return this.member.getMethodName();
- }
-
- public boolean isFor(MethodSignature methodSignature, int occurrence) {
- return this.member.isFor(methodSignature, occurrence);
- }
-
- public ListIterable<String> getParameterTypeNames() {
- return this.member.getParameterTypeNames();
- }
-
- public int getParametersSize() {
- return 0;
- }
-
- public boolean isConstructor() {
- return this.member.isConstructor();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
deleted file mode 100644
index e9837e6ba5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java
+++ /dev/null
@@ -1,926 +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.jpa.core.internal.context.orm;
-
-import java.util.Comparator;
-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.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>entity-mappings</code> element
- */
-public abstract class AbstractEntityMappings
- extends AbstractOrmXmlContextNode
- implements EntityMappings
-{
- protected final XmlEntityMappings xmlEntityMappings;
-
- protected String description;
-
- protected String package_; // "package" is a Java keyword
-
- protected AccessType specifiedAccess;
- protected AccessType defaultAccess;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected final OrmPersistenceUnitMetadata persistenceUnitMetadata;
-
- protected final Vector<OrmPersistentType> persistentTypes = new Vector<OrmPersistentType>();
- protected final PersistentTypeContainerAdapter persistentTypeContainerAdapter = new PersistentTypeContainerAdapter();
-
- protected final ContextListContainer<OrmSequenceGenerator, XmlSequenceGenerator> sequenceGeneratorContainer;
-
- protected final ContextListContainer<OrmTableGenerator, XmlTableGenerator> tableGeneratorContainer;
-
- 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.sequenceGeneratorContainer = this.buildSequenceGeneratorContainer();
- this.tableGeneratorContainer = this.buildTableGeneratorContainer();
-
- 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();
- }
-
- // TODO bjv add to interface
- public OrmXml getOrmXml() {
- return this.getParent();
- }
-
- @Override
- public EntityMappings 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() {
- TextRange textRange = this.xmlEntityMappings.getValidationTextRange();
- return (textRange != null) ? textRange : this.getOrmXml().getValidationTextRange();
- }
-
- 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.resolveType(PERSISTENT_TYPE_LOOKUP_ADAPTER, className);
- }
-
- public JavaResourceAbstractType resolveJavaResourceType(String className) {
- return (JavaResourceAbstractType) this.resolveType(RESOURCE_TYPE_LOOKUP_ADAPTER, className);
- }
-
- protected Object resolveType(TypeLookupAdapter 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 type = adapter.resolveType(this, className);
- if (type != null) {
- return type;
- }
-
- // ...then try to resolve by prepending the global package name
- if (this.getPackage() == null) {
- return null;
- }
- return adapter.resolveType(this, this.getPackage() + '.' + className);
- }
-
- protected interface TypeLookupAdapter {
- Object resolveType(EntityMappings entityMappings, String className);
- }
-
- protected static final TypeLookupAdapter PERSISTENT_TYPE_LOOKUP_ADAPTER =
- new TypeLookupAdapter() {
- public Object resolveType(EntityMappings entityMappings, String className) {
- return entityMappings.getPersistenceUnit().getPersistentType(className);
- }
- };
-
- protected static final TypeLookupAdapter RESOURCE_TYPE_LOOKUP_ADAPTER =
- new TypeLookupAdapter() {
- public Object resolveType(EntityMappings entityMappings, String className) {
- return entityMappings.getJpaProject().getJavaResourceType(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 this.sequenceGeneratorContainer.getContextElements();
- }
-
- public int getSequenceGeneratorsSize() {
- return this.sequenceGeneratorContainer.getContextElementsSize();
- }
-
- public OrmSequenceGenerator addSequenceGenerator() {
- return this.addSequenceGenerator(this.getSequenceGeneratorsSize());
- }
-
- public OrmSequenceGenerator addSequenceGenerator(int index) {
- XmlSequenceGenerator xmlGenerator = this.buildXmlSequenceGenerator();
- OrmSequenceGenerator sequenceGenerator = this.sequenceGeneratorContainer.addContextElement(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.sequenceGeneratorContainer.indexOfContextElement(sequenceGenerator));
- }
-
- public void removeSequenceGenerator(int index) {
- this.sequenceGeneratorContainer.removeContextElement(index);
- this.xmlEntityMappings.getSequenceGenerators().remove(index);
- }
-
- public void moveSequenceGenerator(int targetIndex, int sourceIndex) {
- this.sequenceGeneratorContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlEntityMappings.getSequenceGenerators().move(targetIndex, sourceIndex);
- }
-
- protected void syncSequenceGenerators() {
- this.sequenceGeneratorContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlSequenceGenerator> getXmlSequenceGenerators() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlSequenceGenerator>(this.xmlEntityMappings.getSequenceGenerators());
- }
-
- protected ContextListContainer<OrmSequenceGenerator, XmlSequenceGenerator> buildSequenceGeneratorContainer() {
- return new SequenceGeneratorContainer();
- }
-
- /**
- * sequence generator container
- */
- protected class SequenceGeneratorContainer
- extends ContextListContainer<OrmSequenceGenerator, XmlSequenceGenerator>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SEQUENCE_GENERATORS_LIST;
- }
- @Override
- protected OrmSequenceGenerator buildContextElement(XmlSequenceGenerator resourceElement) {
- return AbstractEntityMappings.this.buildSequenceGenerator(resourceElement);
- }
- @Override
- protected ListIterable<XmlSequenceGenerator> getResourceElements() {
- return AbstractEntityMappings.this.getXmlSequenceGenerators();
- }
- @Override
- protected XmlSequenceGenerator getResourceElement(OrmSequenceGenerator contextElement) {
- return contextElement.getXmlGenerator();
- }
- }
-
-
- // ********** table generators **********
-
- public ListIterable<OrmTableGenerator> getTableGenerators() {
- return this.tableGeneratorContainer.getContextElements();
- }
-
- public int getTableGeneratorsSize() {
- return this.tableGeneratorContainer.getContextElementsSize();
- }
-
- public OrmTableGenerator addTableGenerator() {
- return this.addTableGenerator(this.getTableGeneratorsSize());
- }
-
- public OrmTableGenerator addTableGenerator(int index) {
- XmlTableGenerator xmlTableGenerator = this.buildXmlTableGenerator();
- OrmTableGenerator tableGenerator = this.tableGeneratorContainer.addContextElement(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.tableGeneratorContainer.indexOfContextElement(tableGenerator));
- }
-
- public void removeTableGenerator(int index) {
- this.tableGeneratorContainer.removeContextElement(index);
- this.xmlEntityMappings.getTableGenerators().remove(index);
- }
-
- public void moveTableGenerator(int targetIndex, int sourceIndex) {
- this.tableGeneratorContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlEntityMappings.getTableGenerators().move(targetIndex, sourceIndex);
- }
-
- protected void syncTableGenerators() {
- this.tableGeneratorContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlTableGenerator> getXmlTableGenerators() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlTableGenerator>(this.xmlEntityMappings.getTableGenerators());
- }
-
- protected ContextListContainer<OrmTableGenerator, XmlTableGenerator> buildTableGeneratorContainer() {
- return new TableGeneratorContainer();
- }
-
- /**
- * table generator container
- */
- protected class TableGeneratorContainer
- extends ContextListContainer<OrmTableGenerator, XmlTableGenerator>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return TABLE_GENERATORS_LIST;
- }
- @Override
- protected OrmTableGenerator buildContextElement(XmlTableGenerator resourceElement) {
- return AbstractEntityMappings.this.buildTableGenerator(resourceElement);
- }
- @Override
- protected ListIterable<XmlTableGenerator> getResourceElements() {
- return AbstractEntityMappings.this.getXmlTableGenerators();
- }
- @Override
- protected XmlTableGenerator getResourceElement(OrmTableGenerator contextElement) {
- return contextElement.getXmlGenerator();
- }
- }
-
-
- // ********** query container **********
-
- public OrmQueryContainer getQueryContainer() {
- return this.queryContainer;
- }
-
- protected OrmQueryContainer buildQueryContainer() {
- return this.getContextNodeFactory().buildOrmQueryContainer(this, this.xmlEntityMappings);
- }
-
-
- // ********** validation **********
-
- /**
- * The generators are validated in the persistence unit.
- * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateGenerators(List, IReporter)
- */
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateVersion(messages);
- // generators are validated in the persistence unit
- this.queryContainer.validate(messages, reporter);
- for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) {
- this.validatePersistentType(ormPersistentType, messages, reporter);
- }
- }
-
- protected void validateVersion(List<IMessage> messages) {
- if (! this.getLatestDocumentVersion().equals(this.xmlEntityMappings.getVersion())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.LOW_SEVERITY,
- JpaValidationMessages.XML_VERSION_NOT_LATEST,
- this,
- this.xmlEntityMappings.getVersionTextRange()
- )
- );
- }
- }
-
- /**
- * Return the latest version of the document supported by the platform
- */
- protected String getLatestDocumentVersion() {
- return this.getJpaPlatform().getMostRecentSupportedResourceType(this.getContentType()).getVersion();
- }
-
- protected IContentType getContentType() {
- return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE;
- }
-
- protected void validatePersistentType(OrmPersistentType persistentType, List<IMessage> messages, IReporter reporter) {
- try {
- persistentType.validate(messages, reporter);
- } catch (Throwable exception) {
- JptJpaCorePlugin.log(exception);
- }
- }
-
-
- // ********** refactoring **********
-
- public Iterable<DeleteEdit> createDeleteTypeEdits(final IType type) {
- return new CompositeIterable<DeleteEdit>(
- new TransformationIterable<OrmPersistentType, Iterable<DeleteEdit>>(this.getPersistentTypes()) {
- @Override
- protected Iterable<DeleteEdit> transform(OrmPersistentType persistentType) {
- return persistentType.createDeleteTypeEdits(type);
- }
- }
- );
- }
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(final IType originalType, final String newName) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentType, Iterable<ReplaceEdit>>(this.getPersistentTypes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentType persistentType) {
- return persistentType.createRenameTypeEdits(originalType, newName);
- }
- }
- );
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentType, Iterable<ReplaceEdit>>(this.getPersistentTypes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentType persistentType) {
- return persistentType.createMoveTypeEdits(originalType, newPackage);
- }
- }
- );
- }
-
- @SuppressWarnings("unchecked")
- public Iterable<ReplaceEdit> createRenamePackageEdits(final IPackageFragment originalPackage, final String newName) {
- return new CompositeIterable<ReplaceEdit>(
- this.createPersistentTypeRenamePackageEdits(originalPackage, newName),
- this.createRenamePackageEdit(originalPackage, newName));
- }
-
- protected Iterable<ReplaceEdit> createPersistentTypeRenamePackageEdits(final IPackageFragment originalPackage, final String newName) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentType, Iterable<ReplaceEdit>>(this.getPersistentTypes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentType persistentType) {
- return persistentType.createRenamePackageEdits(originalPackage, newName);
- }
- }
- );
- }
-
- protected Iterable<ReplaceEdit> createRenamePackageEdit(final IPackageFragment originalPackage, final String newName) {
- return Tools.valuesAreEqual(this.package_, originalPackage.getElementName()) ?
- new SingleElementIterable<ReplaceEdit>(this.xmlEntityMappings.createRenamePackageEdit(newName)) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java
deleted file mode 100644
index dc03374687..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java
+++ /dev/null
@@ -1,414 +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.jpa.core.internal.context.orm;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.ColumnMapping;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMultiRelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSingleRelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.SimpleMetamodelField;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmAttributeMapping<X extends XmlAttributeMapping>
- extends AbstractOrmXmlContextNode
- implements OrmAttributeMapping, AttributeMapping2_0
-{
- // never null
- 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();
- }
-
- 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() {
- // this should never be null; also, the persistent attribute delegates
- // to here, so don't delegate back to it (or we will get a stack overflow)
- return this.xmlAttributeMapping.getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange(this.xmlAttributeMapping.getNameTextRange());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** embedded mappings **********
-
- public Iterable<String> getAllMappingNames() {
- return (this.name != null) ?
- new SingleElementIterable<String>(this.name) :
- EmptyIterable.<String>instance();
- }
-
- public Iterable<String> getAllOverridableAttributeMappingNames() {
- return ((this.name != null) && this.isOverridableAttributeMapping()) ?
- new SingleElementIterable<String>(this.name) :
- EmptyIterable.<String>instance();
- }
-
- public Iterable<String> getAllOverridableAssociationMappingNames() {
- return ((this.name != null) && this.isOverridableAssociationMapping()) ?
- new SingleElementIterable<String>(this.name) :
- EmptyIterable.<String>instance();
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- ColumnMapping mapping = this.resolveColumnMapping(attributeName);
- return (mapping == null) ? null : mapping.getColumn();
- }
-
- protected ColumnMapping resolveColumnMapping(String attributeName) {
- AttributeMapping mapping = this.resolveAttributeMapping(attributeName);
- return ((mapping != null) && mapping.isOverridableAttributeMapping()) ? (ColumnMapping) mapping : null;
- }
-
- public Relationship resolveOverriddenRelationship(String attributeName) {
- RelationshipMapping mapping = this.resolveRelationshipMapping(attributeName);
- return (mapping == null) ? null : mapping.getRelationship();
- }
-
- protected RelationshipMapping resolveRelationshipMapping(String attributeName) {
- AttributeMapping mapping = this.resolveAttributeMapping(attributeName);
- return ((mapping != null) && mapping.isOverridableAssociationMapping()) ?
- (RelationshipMapping) mapping :
- null;
- }
-
- public AttributeMapping resolveAttributeMapping(String attributeName) {
- return Tools.valuesAreEqual(attributeName, this.name) ? this : null;
- }
-
- protected Transformer<String, String> buildQualifierTransformer() {
- return new MappingTools.QualifierTransformer(this.name);
- }
-
- protected String unqualify(String attributeName) {
- return MappingTools.unqualify(this.name, attributeName);
- }
-
-
- // ********** metamodel **********
-
- public MetamodelField getMetamodelField() {
- // if we don't have a name we can't build a metamodel field...
- String metamodelFieldName = this.getMetamodelFieldName();
- return (metamodelFieldName == null) ? null :
- new SimpleMetamodelField(
- this.getMetamodelFieldModifiers(),
- this.getMetamodelFieldTypeName(),
- this.getMetamodelFieldTypeArgumentNames(),
- metamodelFieldName
- );
- }
-
- protected Iterable<String> getMetamodelFieldModifiers() {
- return STANDARD_METAMODEL_FIELD_MODIFIERS;
- }
-
- /**
- * most mappings are "singular"
- */
- protected String getMetamodelFieldTypeName() {
- return JPA2_0.SINGULAR_ATTRIBUTE;
- }
-
- protected final Iterable<String> getMetamodelFieldTypeArgumentNames() {
- ArrayList<String> typeArgumentNames = new ArrayList<String>(3);
- typeArgumentNames.add(this.getTypeMapping().getPersistentType().getName());
- this.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames);
- return typeArgumentNames;
- }
-
- /**
- * by default, we add only the mapping's attribute type name;
- * but collection relationship mappings will also need to add the key type
- * name if the "collection" is of type java.util.Map
- */
- protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList<String> typeArgumentNames) {
- typeArgumentNames.add(this.getMetamodelTypeName());
- }
-
- public String getMetamodelTypeName() {
- return ((OrmPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelTypeName();
- }
-
- protected String getMetamodelFieldName() {
- return this.name;
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateAttribute(messages);
- this.validateMapping(messages);
- }
-
- protected void validateAttribute(List<IMessage> messages) {
- if (StringTools.stringIsEmpty(this.name)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME,
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
-
- //TODO validation message - i think more info is needed in this message. include type mapping type?
- protected void validateMapping(List<IMessage> messages) {
- if ( ! this.getTypeMapping().attributeMappingKeyAllowed(this.getKey())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
- new String[] {this.name},
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java
deleted file mode 100644
index cdf0085147..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java
+++ /dev/null
@@ -1,302 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBaseColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn;
-
-/**
- * <code>orm.xml</code> column or join column
- */
-public abstract class AbstractOrmBaseColumn<X extends AbstractXmlColumn, O extends OrmReadOnlyBaseColumn.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 Iterable<String> getCandidateTableNames() {
- return this.owner.getCandidateTableNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getTableTextRange() {
- return this.getValidationTextRange(this.getXmlColumnTableTextRange());
- }
-
- protected TextRange getXmlColumnTableTextRange() {
- X xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getTableTextRange();
- }
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver() {
- return new OrmBaseColumnTextRangeResolver(this);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
deleted file mode 100644
index 73213dc38a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java
+++ /dev/null
@@ -1,301 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.AttributeOverride;
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> embedded or embedded ID mapping
- */
-public abstract class AbstractOrmBaseEmbeddedMapping<X extends AbstractXmlEmbedded>
- extends AbstractOrmAttributeMapping<X>
- implements OrmBaseEmbeddedMapping
-{
- protected final OrmAttributeOverrideContainer attributeOverrideContainer;
-
- protected Embeddable targetEmbeddable;
-
-
- protected AbstractOrmBaseEmbeddedMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.attributeOverrideContainer = this.buildAttributeOverrideContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.attributeOverrideContainer.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.attributeOverrideContainer.update();
- this.setTargetEmbeddable(this.buildTargetEmbeddable());
- }
-
-
- // ********** attribute override container **********
-
- public OrmAttributeOverrideContainer getAttributeOverrideContainer() {
- return this.attributeOverrideContainer;
- }
-
- protected OrmAttributeOverrideContainer buildAttributeOverrideContainer() {
- return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildAttributeOverrideContainerOwner());
- }
-
- protected abstract OrmAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner();
-
-
- // ********** 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 Iterable<String> getAllOverridableAttributeMappingNames() {
- return this.isJpa2_0Compatible() ?
- this.getEmbeddableOverridableAttributeMappingNames() :
- super.getAllOverridableAttributeMappingNames();
- }
-
- protected Iterable<String> getEmbeddableOverridableAttributeMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
- }
-
- @Override
- public Iterable<String> getAllOverridableAssociationMappingNames() {
- return this.isJpa2_0Compatible() ?
- this.getEmbeddableOverridableAssociationMappingNames() :
- super.getAllOverridableAssociationMappingNames();
- }
-
- protected Iterable<String> getEmbeddableOverridableAssociationMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<String> getQualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<String, String>(this.getEmbeddableAttributeMappingNames(transformer), this.buildQualifierTransformer());
- }
-
- protected Iterable<String> getEmbeddableAttributeMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new CompositeIterable<String>(this.getEmbeddableAttributeMappingNamesLists(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 Iterable<Iterable<String>> getEmbeddableAttributeMappingNamesLists(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getEmbeddableAttributeMappings(), transformer);
- }
-
- /**
- * Return the target embeddable's attribute mappings.
- */
- protected Iterable<AttributeMapping> getEmbeddableAttributeMappings() {
- return ((this.targetEmbeddable != null) && (this.targetEmbeddable != this.getTypeMapping())) ?
- this.targetEmbeddable.getAttributeMappings() :
- EmptyIterable.<AttributeMapping>instance();
- }
-
-
- // ********** misc **********
-
- @Override
- protected void initializeFromOrmBaseEmbeddedMapping(OrmBaseEmbeddedMapping oldMapping) {
- super.initializeFromOrmBaseEmbeddedMapping(oldMapping);
- this.attributeOverrideContainer.initializeFrom(oldMapping.getAttributeOverrideContainer());
- }
-
- @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 abstract class AttributeOverrideContainerOwner
- implements OrmAttributeOverrideContainer.Owner
- {
- public OrmTypeMapping getTypeMapping() {
- return AbstractOrmBaseEmbeddedMapping.this.getTypeMapping();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return AbstractOrmBaseEmbeddedMapping.this.getTargetEmbeddable();
- }
-
- public Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? this.getAllOverridableAttributeNames_(overriddenTypeMapping) : EmptyIterable.<String>instance();
- }
-
- /**
- * pre-condition: type mapping is not <code>null</code>
- * <p>
- * NB: Overridden in {@link GenericOrmEmbeddedIdMapping.AttributeOverrideContainerOwner}
- */
- protected Iterable<String> getAllOverridableAttributeNames_(TypeMapping overriddenTypeMapping) {
- return overriddenTypeMapping.getAllOverridableAttributeNames();
- }
-
- public Iterable<String> getJavaOverrideNames() {
- return null;
- }
-
- public EList<XmlAttributeOverride> getXmlOverrides() {
- return AbstractOrmBaseEmbeddedMapping.this.getXmlAttributeMapping().getAttributeOverrides();
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getTypeMapping().getPrimaryTableName();
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AttributeOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
- }
-
- public TextRange getValidationTextRange() {
- return AbstractOrmBaseEmbeddedMapping.this.getValidationTextRange();
- }
-
- protected OrmPersistentAttribute getPersistentAttribute() {
- return AbstractOrmBaseEmbeddedMapping.this.getPersistentAttribute();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java
deleted file mode 100644
index cec4aa4f4d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java
+++ /dev/null
@@ -1,424 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> basic mapping
- */
-public abstract class AbstractOrmBasicMapping<X extends XmlBasic>
- extends AbstractOrmAttributeMapping<X>
- implements OrmBasicMapping
-{
- protected final OrmColumn column;
-
- protected FetchType specifiedFetch;
- protected FetchType defaultFetch;
-
- protected Boolean specifiedOptional;
- protected boolean defaultOptional;
-
- protected OrmConverter converter; // never null
-
-
- protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
- OrmEnumeratedConverter.Adapter.instance(),
- OrmTemporalConverter.Adapter.instance(),
- OrmLobConverter.Adapter.instance()
- };
- protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
-
-
- protected AbstractOrmBasicMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.column = this.buildColumn();
- this.specifiedFetch = this.buildSpecifiedFetch();
- this.specifiedOptional = this.buildSpecifiedOptional();
- this.converter = this.buildConverter();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.column.synchronizeWithResourceModel();
- this.setSpecifiedFetch_(this.buildSpecifiedFetch());
- this.setSpecifiedOptional_(this.buildSpecifiedOptional());
- this.syncConverter();
- }
-
- @Override
- public void update() {
- super.update();
- this.column.update();
- this.setDefaultFetch(this.buildDefaultFetch());
- this.setDefaultOptional(this.buildDefaultOptional());
- this.converter.update();
- }
-
-
- // ********** column **********
-
- public OrmColumn getColumn() {
- return this.column;
- }
-
- protected OrmColumn buildColumn() {
- return this.getContextNodeFactory().buildOrmColumn(this, this);
- }
-
-
- // ********** fetch **********
-
- public FetchType getFetch() {
- return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType fetch) {
- this.setSpecifiedFetch_(fetch);
- this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch));
- }
-
- protected void setSpecifiedFetch_(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType buildSpecifiedFetch() {
- return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch());
- }
-
- public FetchType getDefaultFetch() {
- return this.defaultFetch;
- }
-
- protected void setDefaultFetch(FetchType fetch) {
- FetchType old = this.defaultFetch;
- this.defaultFetch = fetch;
- this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType buildDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
-
- // ********** optional **********
-
- public boolean isOptional() {
- return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.isDefaultOptional();
- }
-
- public Boolean getSpecifiedOptional() {
- return this.specifiedOptional;
- }
-
- public void setSpecifiedOptional(Boolean optional) {
- this.setSpecifiedOptional_(optional);
- this.xmlAttributeMapping.setOptional(optional);
- }
-
- protected void setSpecifiedOptional_(Boolean optional) {
- Boolean old = this.specifiedOptional;
- this.specifiedOptional = optional;
- this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional);
- }
-
- protected Boolean buildSpecifiedOptional() {
- return this.xmlAttributeMapping.getOptional();
- }
-
- public boolean isDefaultOptional() {
- return this.defaultOptional;
- }
-
- protected void setDefaultOptional(boolean optional) {
- boolean old = this.defaultOptional;
- this.defaultOptional = optional;
- this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional);
- }
-
- protected boolean buildDefaultOptional() {
- return DEFAULT_OPTIONAL;
- }
-
-
- // ********** converter **********
-
- public OrmConverter getConverter() {
- return this.converter;
- }
-
- public void setConverter(Class<? extends Converter> converterType) {
- if (this.converter.getType() != converterType) {
- // note: we may also clear the XML value we want;
- // but if we leave it, the resulting sync will screw things up...
- this.clearXmlConverterValues();
- OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
- this.setConverter_(this.buildConverter(converterAdapter));
- this.converter.initialize();
- }
- }
-
- protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
- return (converterAdapter != null) ?
- converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullConverter();
- }
-
- protected void setConverter_(OrmConverter converter) {
- Converter old = this.converter;
- this.converter = converter;
- this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
- }
-
- protected void clearXmlConverterValues() {
- for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
- adapter.clearXmlValue(this.xmlAttributeMapping);
- }
- }
-
- protected OrmConverter buildConverter() {
- OrmXmlContextNodeFactory factory = this.getContextNodeFactory();
- for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
- OrmConverter ormConverter = adapter.buildConverter(this, factory);
- if (ormConverter != null) {
- return ormConverter;
- }
- }
- return this.buildNullConverter();
- }
-
- protected void syncConverter() {
- OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
- if (adapter == null) {
- if (this.converter.getType() != null) {
- this.setConverter_(this.buildNullConverter());
- }
- } else {
- if (this.converter.getType() == adapter.getConverterType()) {
- this.converter.synchronizeWithResourceModel();
- } else {
- this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory()));
- }
- }
- }
-
- /**
- * Return the first adapter whose converter value is set in the XML mapping.
- * Return <code>null</code> if there are no converter values in the XML.
- */
- protected OrmConverter.Adapter getXmlConverterAdapter() {
- for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
- if (adapter.isActive(this.xmlAttributeMapping)) {
- return adapter;
- }
- }
- return null;
- }
-
- protected OrmConverter buildNullConverter() {
- return new NullOrmConverter(this);
- }
-
-
- // ********** converter adapters **********
-
- /**
- * Return the converter adapter for the specified converter type.
- */
- protected OrmConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
- for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
- if (adapter.getConverterType() == converterType) {
- return adapter;
- }
- }
- return null;
- }
-
- protected Iterable<OrmConverter.Adapter> getConverterAdapters() {
- return CONVERTER_ADAPTERS;
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmBasicMapping(this);
- }
-
- @Override
- protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
- super.initializeFromOrmColumnMapping(oldMapping);
- this.column.initializeFrom(oldMapping.getColumn());
- }
-
- public int getXmlSequence() {
- return 20;
- }
-
- @Override
- public boolean isOverridableAttributeMapping() {
- return true;
- }
-
- public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
- xmlAttributes.getBasics().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
- xmlAttributes.getBasics().remove(this.xmlAttributeMapping);
- }
-
-
- // ********** OrmColumn.Owner implementation **********
-
- public String getDefaultColumnName() {
- return this.name;
- }
-
- public String getDefaultTableName() {
- return this.getTypeMapping().getPrimaryTableName();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- 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(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java
deleted file mode 100644
index c71e572580..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java
+++ /dev/null
@@ -1,101 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-
-/**
- * <code>orm.xml</code> embeddable type mapping
- */
-public abstract class AbstractOrmEmbeddable<X extends XmlEmbeddable>
- extends AbstractOrmTypeMapping<X>
- implements OrmEmbeddable
-{
- protected AbstractOrmEmbeddable(OrmPersistentType parent, X resourceMapping) {
- super(parent, resourceMapping);
- }
-
-
- // ********** key **********
-
- public String getKey() {
- return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
-
- // ********** id class **********
-
- public JavaPersistentType getIdClass() {
- return null;
- }
-
-
- // ********** tables **********
-
- public Iterable<ReadOnlyTable> getAssociatedTables() {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReadOnlyTable> getAllAssociatedTables() {
- return EmptyIterable.instance();
- }
-
- public Iterable<String> getAllAssociatedTableNames() {
- return EmptyIterable.instance();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
-
- // ********** Java **********
-
- @Override
- public JavaEmbeddable getJavaTypeMapping() {
- return (JavaEmbeddable) super.getJavaTypeMapping();
- }
-
- @Override
- public JavaEmbeddable getJavaTypeMappingForDefaults() {
- return (JavaEmbeddable) super.getJavaTypeMappingForDefaults();
- }
-
-
- // ********** entity mappings **********
-
- public int getXmlSequence() {
- return 2;
- }
-
- public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) {
- entityMappings.getEmbeddables().add(this.xmlTypeMapping);
- }
-
- public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) {
- entityMappings.getEmbeddables().remove(this.xmlTypeMapping);
- }
-
-
- // ********** validation **********
-
- @Override
- public boolean validatesAgainstDatabase() {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
deleted file mode 100644
index f898a0df1d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java
+++ /dev/null
@@ -1,2207 +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.jpa.core.internal.context.orm;
-
-import java.util.Iterator;
-import java.util.List;
-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.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.NotNullFilter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator;
-import org.eclipse.jpt.jpa.core.JpaPlatformVariation.Supported;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AssociationOverride;
-import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.AttributeOverride;
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.InheritanceType;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.SecondaryTable;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.DiscriminatorColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityPrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MappedSuperclassOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTableValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.TableValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Inheritance;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> entity
- */
-public abstract class AbstractOrmEntity<X extends XmlEntity>
- extends AbstractOrmTypeMapping<X>
- implements OrmEntity, OrmCacheableHolder2_0, OrmIdClassReference.Owner
-{
- protected String specifiedName;
- protected String defaultName;
-
- protected Entity rootEntity;
- protected final Vector<Entity> descendants = new Vector<Entity>();
-
- protected final OrmIdClassReference idClassReference;
-
- protected final OrmTable table;
- protected boolean specifiedTableIsAllowed;
- protected boolean tableIsUndefined;
-
- protected final ReadOnlyTable.Owner secondaryTableOwner;
- protected final ContextListContainer<OrmSecondaryTable, XmlSecondaryTable> specifiedSecondaryTableContainer;
- protected final ContextListContainer<OrmVirtualSecondaryTable, JavaSecondaryTable> virtualSecondaryTableContainer;
-
- protected final PrimaryKeyJoinColumnOwner primaryKeyJoinColumnOwner;
- protected final ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumnContainer;
-
- // 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.secondaryTableOwner = this.buildSecondaryTableOwner();
- this.specifiedSecondaryTableContainer = this.buildSpecifiedSecondaryTableContainer();
- this.virtualSecondaryTableContainer = this.buildVirtualSecondaryTableContainer();
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.specifiedPrimaryKeyJoinColumnContainer = this.buildSpecifiedPrimaryKeyJoinColumnContainer();
- 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 ReadOnlyTable.Owner
- {
- public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return new TableValidator(table, textRangeResolver);
- }
- }
-
-
- // ********** secondary tables **********
-
- public ListIterable<ReadOnlySecondaryTable> getSecondaryTables() {
- return this.getSpecifiedSecondaryTablesSize() == 0 ?
- this.getReadOnlyVirtualSecondaryTables() :
- this.getReadOnlySpecifiedSecondaryTables();
- }
-
- public int getSecondaryTablesSize() {
- return this.getSpecifiedSecondaryTablesSize() == 0 ?
- this.getVirtualSecondaryTablesSize() :
- this.getSpecifiedSecondaryTablesSize();
- }
-
-
- // ********** specified secondary tables **********
-
- public ListIterable<OrmSecondaryTable> getSpecifiedSecondaryTables() {
- return this.specifiedSecondaryTableContainer.getContextElements();
- }
-
- protected ListIterable<ReadOnlySecondaryTable> getReadOnlySpecifiedSecondaryTables() {
- return new SuperListIterableWrapper<ReadOnlySecondaryTable>(this.getSpecifiedSecondaryTables());
- }
-
- public int getSpecifiedSecondaryTablesSize() {
- return this.specifiedSecondaryTableContainer.getContextElementsSize();
- }
-
- public OrmSecondaryTable addSpecifiedSecondaryTable() {
- return this.addSpecifiedSecondaryTable(this.getSpecifiedSecondaryTablesSize());
- }
-
- /**
- * no state check
- */
- protected OrmSecondaryTable addSpecifiedSecondaryTable_() {
- return this.addSpecifiedSecondaryTable_(this.getSpecifiedSecondaryTablesSize());
- }
-
- /**
- * @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.specifiedSecondaryTableContainer.addContextElement(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.specifiedSecondaryTableContainer.indexOfContextElement((OrmSecondaryTable) secondaryTable));
- }
-
- public void removeSpecifiedSecondaryTable(int index) {
- this.specifiedSecondaryTableContainer.removeContextElement(index);
- this.xmlTypeMapping.getSecondaryTables().remove(index);
- }
-
- public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) {
- this.specifiedSecondaryTableContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlTypeMapping.getSecondaryTables().move(targetIndex, sourceIndex);
- }
-
- protected OrmSecondaryTable buildSpecifiedSecondaryTable(XmlSecondaryTable xmlSecondaryTable) {
- return this.getContextNodeFactory().buildOrmSecondaryTable(this, this.secondaryTableOwner, xmlSecondaryTable);
- }
-
- protected void clearSpecifiedSecondaryTables() {
- this.specifiedSecondaryTableContainer.clearContextList();
- this.xmlTypeMapping.getSecondaryTables().clear();
- }
-
- protected void syncSpecifiedSecondaryTables() {
- this.specifiedSecondaryTableContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlSecondaryTable> getXmlSecondaryTables() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlSecondaryTable>(this.xmlTypeMapping.getSecondaryTables());
- }
-
- protected ContextListContainer<OrmSecondaryTable, XmlSecondaryTable> buildSpecifiedSecondaryTableContainer() {
- return new SpecifiedSecondaryTableContainer();
- }
-
- /**
- * specified secondary table container
- */
- protected class SpecifiedSecondaryTableContainer
- extends ContextListContainer<OrmSecondaryTable, XmlSecondaryTable>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_SECONDARY_TABLES_LIST;
- }
- @Override
- protected OrmSecondaryTable buildContextElement(XmlSecondaryTable resourceElement) {
- return AbstractOrmEntity.this.buildSpecifiedSecondaryTable(resourceElement);
- }
- @Override
- protected ListIterable<XmlSecondaryTable> getResourceElements() {
- return AbstractOrmEntity.this.getXmlSecondaryTables();
- }
- @Override
- protected XmlSecondaryTable getResourceElement(OrmSecondaryTable contextElement) {
- return contextElement.getXmlTable();
- }
- }
-
-
- // ********** virtual secondary tables **********
-
- public ListIterable<OrmVirtualSecondaryTable> getVirtualSecondaryTables() {
- return this.virtualSecondaryTableContainer.getContextElements();
- }
-
- protected ListIterable<ReadOnlySecondaryTable> getReadOnlyVirtualSecondaryTables() {
- return new SuperListIterableWrapper<ReadOnlySecondaryTable>(this.getVirtualSecondaryTables());
- }
-
- public int getVirtualSecondaryTablesSize() {
- return this.virtualSecondaryTableContainer.getContextElementsSize();
- }
-
- protected void clearVirtualSecondaryTables() {
- this.virtualSecondaryTableContainer.clearContextList();
- }
-
- /**
- * 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() {
- this.virtualSecondaryTableContainer.update();
- }
-
- protected ListIterable<JavaSecondaryTable> getJavaSecondaryTablesForVirtuals() {
- if (this.getSpecifiedSecondaryTablesSize() > 0) {
- return EmptyListIterable.instance();
- }
- JavaEntity javaEntity = this.getJavaTypeMappingForDefaults();
- return (javaEntity == null) ?
- EmptyListIterable.<JavaSecondaryTable>instance() :
- javaEntity.getSecondaryTables();
- }
-
- protected void moveVirtualSecondaryTable(int index, OrmVirtualSecondaryTable secondaryTable) {
- this.virtualSecondaryTableContainer.moveContextElement(index, secondaryTable);
- }
-
- protected OrmVirtualSecondaryTable addVirtualSecondaryTable(int index, JavaSecondaryTable javaSecondaryTable) {
- return this.virtualSecondaryTableContainer.addContextElement(index, javaSecondaryTable);
- }
-
- protected OrmVirtualSecondaryTable buildVirtualSecondaryTable(JavaSecondaryTable javaSecondaryTable) {
- return this.getContextNodeFactory().buildOrmVirtualSecondaryTable(this, this.secondaryTableOwner, javaSecondaryTable);
- }
-
- protected void removeVirtualSecondaryTable(OrmVirtualSecondaryTable secondaryTable) {
- this.virtualSecondaryTableContainer.removeContextElement(secondaryTable);
- }
-
- protected ContextListContainer<OrmVirtualSecondaryTable, JavaSecondaryTable> buildVirtualSecondaryTableContainer() {
- return new VirtualSecondaryTableContainer();
- }
-
- /**
- * virtual secondary table container
- */
- protected class VirtualSecondaryTableContainer
- extends ContextListContainer<OrmVirtualSecondaryTable, JavaSecondaryTable>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_SECONDARY_TABLES_LIST;
- }
- @Override
- protected OrmVirtualSecondaryTable buildContextElement(JavaSecondaryTable resourceElement) {
- return AbstractOrmEntity.this.buildVirtualSecondaryTable(resourceElement);
- }
- @Override
- protected ListIterable<JavaSecondaryTable> getResourceElements() {
- return AbstractOrmEntity.this.getJavaSecondaryTablesForVirtuals();
- }
- @Override
- protected JavaSecondaryTable getResourceElement(OrmVirtualSecondaryTable contextElement) {
- return contextElement.getOverriddenTable();
- }
- }
-
-
- // ********** 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.getVirtualSecondaryTablesSize() == 0;
- }
-
- 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() {
- for (OrmVirtualSecondaryTable oldVirtualSecondaryTable : getVirtualSecondaryTables()) {
- 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
- }
-
- protected Table.Owner buildSecondaryTableOwner() {
- return new SecondaryTableOwner();
- }
-
- protected static class SecondaryTableOwner
- implements ReadOnlyTable.Owner
- {
- public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return new SecondaryTableValidator((ReadOnlySecondaryTable) table, textRangeResolver);
- }
- }
-
-
- // ********** primary key join columns **********
-
- public ListIterable<ReadOnlyPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumnsSize() == 0 ?
- this.getDefaultPrimaryKeyJoinColumns() :
- this.getReadOnlySpecifiedPrimaryKeyJoinColumns();
- }
-
- public int getPrimaryKeyJoinColumnsSize() {
- return this.getSpecifiedPrimaryKeyJoinColumnsSize() == 0 ?
- this.getDefaultPrimaryKeyJoinColumnsSize() :
- this.getSpecifiedPrimaryKeyJoinColumnsSize();
- }
-
- protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlPkJoinColumn) {
- return this.getContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, xmlPkJoinColumn);
- }
-
-
- // ********** specified primary key join columns **********
-
- public ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
- }
-
- protected ListIterable<ReadOnlyPrimaryKeyJoinColumn> getReadOnlySpecifiedPrimaryKeyJoinColumns() {
- return new SuperListIterableWrapper<ReadOnlyPrimaryKeyJoinColumn>(this.getSpecifiedPrimaryKeyJoinColumns());
- }
-
- public int getSpecifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
- }
-
- public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.getSpecifiedPrimaryKeyJoinColumnsSize());
- }
-
- public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- this.clearDefaultPrimaryKeyJoinColumns(); // could leave for update?
-
- XmlPrimaryKeyJoinColumn xmlPkJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn pkJoinColumn = this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(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.specifiedPrimaryKeyJoinColumnContainer.indexOfContextElement((OrmPrimaryKeyJoinColumn) primaryKeyJoinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(index);
- this.xmlTypeMapping.getPrimaryKeyJoinColumns().remove(index);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlTypeMapping.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
- }
-
- protected PrimaryKeyJoinColumnOwner buildPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- protected void syncSpecifiedPrimaryKeyJoinColumns() {
- this.specifiedPrimaryKeyJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlPrimaryKeyJoinColumn>(this.xmlTypeMapping.getPrimaryKeyJoinColumns());
- }
-
- protected ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> buildSpecifiedPrimaryKeyJoinColumnContainer() {
- return new SpecifiedPrimaryKeyJoinColumnContainer();
- }
-
- /**
- * specified primary key join column container
- */
- protected class SpecifiedPrimaryKeyJoinColumnContainer
- extends ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmPrimaryKeyJoinColumn buildContextElement(XmlPrimaryKeyJoinColumn resourceElement) {
- return AbstractOrmEntity.this.buildPrimaryKeyJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
- return AbstractOrmEntity.this.getXmlPrimaryKeyJoinColumns();
- }
- @Override
- protected XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- }
-
-
- // ********** default primary key join columns **********
-
- public ListIterable<ReadOnlyPrimaryKeyJoinColumn> getDefaultPrimaryKeyJoinColumns() {
- int virtualSize = this.virtualPrimaryKeyJoinColumns.size();
- return (virtualSize != 0) ?
- this.getReadOnlyVirtualPrimaryKeyJoinColumns() :
- this.getReadOnlyDefaultPrimaryKeyJoinColumns();
- }
-
- public int getDefaultPrimaryKeyJoinColumnsSize() {
- 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.getSpecifiedPrimaryKeyJoinColumnsSize() > 0) {
- // specified/java/default => specified
- this.clearDefaultPrimaryKeyJoinColumns();
- } else {
- // specified
- if (this.getDefaultPrimaryKeyJoinColumnsSize() == 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.getPrimaryKeyJoinColumnsSize() > 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 this.getJavaTypeMappingForDefaults().getPrimaryKeyJoinColumns();
- }
-
- 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();
- }
-
-
- // ********** override container **********
-
- protected JavaEntity getJavaOverrideContainerEntity() {
- if (this.isMetadataComplete()) {
- return null;
- }
- JavaPersistentType javaType = this.getJavaPersistentType();
- if (javaType == null) {
- return null;
- }
- JavaTypeMapping javaTypeMapping = javaType.getMapping();
- return (javaTypeMapping instanceof JavaEntity) ? (JavaEntity) javaTypeMapping : null;
- }
-
-
- // ********** 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 ReadOnlyColumn 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 ReadOnlyRelationship 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 Iterable<ReadOnlyTable> getAssociatedTables() {
- return new CompositeIterable<ReadOnlyTable>(this.table, this.getSecondaryTables());
- }
-
- public Iterable<ReadOnlyTable> getAllAssociatedTables() {
- return CollectionTools.iterable(this.allAssociatedTables());
- }
-
- public Iterator<ReadOnlyTable> allAssociatedTables() {
- return new CompositeIterator<ReadOnlyTable>(this.allAssociatedTablesLists());
- }
-
- // TODO eliminate duplicate tables?
- protected Iterable<Iterable<ReadOnlyTable>> allAssociatedTablesLists() {
- return new TransformationIterable<TypeMapping, Iterable<ReadOnlyTable>>(this.getInheritanceHierarchy(), TypeMappingTools.ASSOCIATED_TABLES_TRANSFORMER);
- }
-
- 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 || this.tableNameIsValid_(tableName);
- }
-
- protected boolean tableNameIsValid_(String tableName) {
- return this.connectionProfileIsActive() ?
- (this.resolveDbTable(tableName) != null) :
- CollectionTools.contains(this.getAllAssociatedTableNames(), tableName);
- }
-
-
- // ********** Java **********
-
- @Override
- public JavaEntity getJavaTypeMapping() {
- return (JavaEntity) super.getJavaTypeMapping();
- }
-
- @Override
- public JavaEntity getJavaTypeMappingForDefaults() {
- return (JavaEntity) super.getJavaTypeMappingForDefaults();
- }
-
-
- // ********** database **********
-
- @Override
- public String getPrimaryTableName() {
- return this.table.getName();
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() {
- return this.table.getDbTable();
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- // matching database objects and identifiers is database platform-specific
- return this.getDataSource().selectTableForIdentifier(this.getAllAssociatedDbTables(), tableName);
- }
-
- /**
- * strip out null db tables
- */
- protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables() {
- return new FilteringIterable<org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedDbTables_(), NotNullFilter.<org.eclipse.jpt.jpa.db.Table>instance());
- }
-
- protected Iterable<org.eclipse.jpt.jpa.db.Table> getAllAssociatedDbTables_() {
- return new TransformationIterable<ReadOnlyTable, org.eclipse.jpt.jpa.db.Table>(this.getAllAssociatedTables()) {
- @Override
- protected org.eclipse.jpt.jpa.db.Table transform(ReadOnlyTable t) {
- return t.getDbTable();
- }
- };
- }
-
- @Override
- public Schema getDbSchema() {
- return this.table.getDbSchema();
- }
-
-
- // ********** primary key **********
-
- public String getPrimaryKeyColumnName() {
- return MappingTools.getPrimaryKeyColumnName(this);
- }
-
- public PersistentAttribute getIdAttribute() {
- Iterator<AttributeMapping> idAttributeMappings = this.getAllAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY).iterator();
- if (idAttributeMappings.hasNext()) {
- PersistentAttribute attribute = idAttributeMappings.next().getPersistentAttribute();
- return idAttributeMappings.hasNext() ? null /*more than one*/: attribute;
- }
- return null;
- }
-
-
- // ********** key **********
-
- public String getKey() {
- return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
-
- // ********** entity mappings **********
-
- public int getXmlSequence() {
- return 1;
- }
-
- public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) {
- entityMappings.getEntities().add(this.xmlTypeMapping);
- }
-
- public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) {
- entityMappings.getEntities().remove(this.xmlTypeMapping);
- }
-
-
- // ********** attribute mappings **********
-
- @Override
- public Column resolveOverriddenColumn(String attributeName) {
- if (this.isJpa2_0Compatible()) {
- // strip off the first segment
- int dotIndex = attributeName.indexOf('.');
- if (dotIndex != -1) {
- AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName.substring(dotIndex + 1));
- if (override != null) {
- return override.getColumn();
- }
- }
- }
- return super.resolveOverriddenColumn(attributeName);
- }
-
- @Override
- public Iterable<String> getOverridableAttributeNames() {
- return this.isTablePerClass() ?
- super.getOverridableAttributeNames() :
- EmptyIterable.<String>instance();
- }
-
- @Override
- public Iterable<String> getOverridableAssociationNames() {
- return this.isTablePerClass() ?
- super.getOverridableAssociationNames() :
- EmptyIterable.<String>instance();
- }
-
- public AttributeMapping resolveAttributeMapping(String name) {
- for (AttributeMapping attributeMapping : this.getAllAttributeMappings()) {
- 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() {
- JavaResourceType jrt = this.getJavaResourceType();
- return (jrt != null) && jrt.isAbstract();
- }
-
- /**
- * Return whether the entity's type is abstract.
- */
- protected boolean isFinal() {
- JavaResourceType jrt = this.getJavaResourceType();
- return (jrt != null) && jrt.isFinal();
- }
-
- /**
- * Return whether the entity's type is a member of another type.
- */
- protected boolean isMember() {
- JavaResourceType jrt = this.getJavaResourceType();
- return (jrt != null) && jrt.isMemberType();
- }
-
- /**
- * Return whether the entity's type is static.
- */
- protected boolean isStatic() {
- JavaResourceType jrt = this.getJavaResourceType();
- return (jrt != null) && jrt.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);
- this.idClassReference.validate(messages, reporter);
- }
-
- protected void validateEntityName(List<IMessage> messages) {
- 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 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() && this.getDataSource().connectionProfileIsActive()) {
- if (this.specifiedTableDoesNotMatchRootTable()) {
- 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);
- }
-
- /**
- * Return whether the entity specifies a table and it is a different table
- * than the root entity's table.
- */
- protected boolean specifiedTableDoesNotMatchRootTable() {
- return this.table.isSpecifiedInResource() &&
- (this.table.getDbTable() != this.getRootEntity().getTable().getDbTable());
- }
-
- 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.getValidationTextRange(this.xmlTypeMapping.getDiscriminatorValueTextRange());
- }
-
- protected TextRange getDiscriminatorColumnTextRange() {
- return this.getValidationTextRange(this.xmlTypeMapping.getDiscriminatorColumn().getValidationTextRange());
- }
-
- protected TextRange getInheritanceStrategyTextRange() {
- return this.getValidationTextRange(this.xmlTypeMapping.getInheritanceStrategyTextRange());
- }
-
-
- // ********** OrmOverrideContainer.Owner implementation **********
-
- /**
- * some common behavior
- */
- protected abstract class OverrideContainerOwner
- implements OrmOverrideContainer.Owner
- {
- public AbstractOrmEntity<?> getTypeMapping() {
- return AbstractOrmEntity.this;
- }
-
- public TextRange getValidationTextRange() {
- return AbstractOrmEntity.this.getValidationTextRange();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return AbstractOrmEntity.this.getOverridableTypeMapping();
- }
-
- /**
- * Use the Java overrides if appropriate, so we bring over any invalid
- * overrides also.
- * @see JavaOverrideContainer#getOverrideNames()
- */
- public Iterable<String> getJavaOverrideNames() {
- JavaEntity javaEntity = this.getJavaOverrideContainerEntity();
- return (javaEntity == null) ? null : this.getOverrideContainer(javaEntity).getOverrideNames();
- }
-
- /**
- * Return the Java entity with the corresponding override container.
- * Return <code>null</code> if not appropriate.
- */
- protected JavaEntity getJavaOverrideContainerEntity() {
- return AbstractOrmEntity.this.getJavaOverrideContainerEntity();
- }
-
- protected abstract JavaOverrideContainer getOverrideContainer(JavaEntity javaEntity);
-
- public Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? this.getAllOverridableNames_(overriddenTypeMapping) : EmptyIterable.<String>instance();
- }
-
- /**
- * pre-condition: <code>typeMapping</code> is not <code>null</code>
- */
- protected abstract Iterable<String> getAllOverridableNames_(TypeMapping overriddenTypeMapping);
-
- public String getDefaultTableName() {
- return AbstractOrmEntity.this.getPrimaryTableName();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return AbstractOrmEntity.this.tableNameIsInvalid(tableName);
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return AbstractOrmEntity.this.resolveDbTable(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return AbstractOrmEntity.this.getAllAssociatedTableNames();
- }
- }
-
-
- // ********** OrmAttributeOverrideContainer.Owner implementation **********
-
- protected class AttributeOverrideContainerOwner
- extends OverrideContainerOwner
- implements OrmAttributeOverrideContainer.Owner
- {
- @Override
- protected JavaOverrideContainer getOverrideContainer(JavaEntity javaEntity) {
- return javaEntity.getAttributeOverrideContainer();
- }
-
- @Override
- protected Iterable<String> getAllOverridableNames_(TypeMapping overriddenTypeMapping) {
- return new FilteringIterable<String>(overriddenTypeMapping.getAllOverridableAttributeNames()) {
- @Override
- protected boolean accept(String attributeName) {
- return ! AttributeOverrideContainerOwner.this.getTypeMapping().attributeIsDerivedId(attributeName);
- }
- };
- }
-
- public EList<XmlAttributeOverride> getXmlOverrides() {
- return AbstractOrmEntity.this.xmlTypeMapping.getAttributeOverrides();
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AttributeOverrideValidator((ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AttributeOverrideColumnValidator((ReadOnlyAttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider());
- }
-
- public ReadOnlyColumn resolveOverriddenColumn(String attributeName) {
- JavaEntity javaEntity = this.getJavaOverrideContainerEntity();
- return (javaEntity != null) ?
- javaEntity.getAttributeOverrideContainer().getOverrideColumn(attributeName) :
- AbstractOrmEntity.this.resolveOverriddenColumnForAttributeOverride(attributeName);
- }
- }
-
-
- // ********** OrmAssociationOverrideContainer.Owner implementation **********
-
- protected class AssociationOverrideContainerOwner
- extends OverrideContainerOwner
- implements OrmAssociationOverrideContainer2_0.Owner
- {
- @Override
- protected JavaOverrideContainer getOverrideContainer(JavaEntity javaEntity) {
- return javaEntity.getAssociationOverrideContainer();
- }
-
- @Override
- protected Iterable<String> getAllOverridableNames_(TypeMapping typeMapping) {
- return typeMapping.getAllOverridableAssociationNames();
- }
-
- public EList<XmlAssociationOverride> getXmlOverrides() {
- return AbstractOrmEntity.this.xmlTypeMapping.getAssociationOverrides();
- }
-
- public ReadOnlyRelationship resolveOverriddenRelationship(String attributeName) {
- JavaEntity javaEntity = this.getJavaOverrideContainerEntity();
- return (javaEntity != null) ?
- javaEntity.getAssociationOverrideContainer().getOverrideRelationship(attributeName) :
- AbstractOrmEntity.this.resolveOverriddenRelationshipForAssociationOverride(attributeName);
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AssociationOverrideValidator((ReadOnlyAssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator((ReadOnlyAssociationOverride) override, (ReadOnlyJoinColumn) column, (ReadOnlyJoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable t, TableTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinTableValidator(override, (ReadOnlyJoinTable) t, textRangeResolver);
- }
- }
-
-
- // ********** OrmNamedColumn.Owner implementation **********
-
- /**
- * some common behavior
- */
- protected abstract class NamedColumnOwner
- implements OrmReadOnlyNamedColumn.Owner
- {
- public TypeMapping getTypeMapping() {
- return AbstractOrmEntity.this;
- }
-
- public String getDefaultTableName() {
- return AbstractOrmEntity.this.getPrimaryTableName();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return AbstractOrmEntity.this.resolveDbTable(tableName);
- }
-
- public TextRange getValidationTextRange() {
- return AbstractOrmEntity.this.getValidationTextRange();
- }
- }
-
-
- // ********** OrmBaseJoinColumn.Owner implementation **********
-
- protected class PrimaryKeyJoinColumnOwner
- extends NamedColumnOwner
- implements OrmReadOnlyBaseJoinColumn.Owner
- {
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- Entity parentEntity = AbstractOrmEntity.this.getParentEntity();
- return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
- }
-
- public int getJoinColumnsSize() {
- return AbstractOrmEntity.this.getPrimaryKeyJoinColumnsSize();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return CollectionTools.contains(AbstractOrmEntity.this.getDefaultPrimaryKeyJoinColumns(), joinColumn);
- }
-
- public String getDefaultColumnName() {
- if (this.getJoinColumnsSize() != 1) {
- return null;
- }
- Entity parentEntity = AbstractOrmEntity.this.getParentEntity();
- return (parentEntity == null) ? AbstractOrmEntity.this.getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new EntityPrimaryKeyJoinColumnValidator((ReadOnlyBaseJoinColumn) 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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new DiscriminatorColumnValidator(column, textRangeResolver);
- }
-
- public XmlDiscriminatorColumn getXmlColumn() {
- return this.getXmlEntity().getDiscriminatorColumn();
- }
-
- public XmlDiscriminatorColumn buildXmlColumn() {
- XmlDiscriminatorColumn xmlColumn = OrmFactory.eINSTANCE.createXmlDiscriminatorColumn();
- this.getXmlEntity().setDiscriminatorColumn(xmlColumn);
- return xmlColumn;
- }
-
- public void removeXmlColumn() {
- this.getXmlEntity().setDiscriminatorColumn(null);
- }
-
- protected XmlEntity getXmlEntity() {
- return AbstractOrmEntity.this.getXmlTypeMapping();
- }
-
- protected DiscriminatorColumn getRootDiscriminatorColumn() {
- return AbstractOrmEntity.this.rootEntity.getDiscriminatorColumn();
- }
-
- protected boolean isMetadataComplete() {
- return AbstractOrmEntity.this.isMetadataComplete();
- }
-
- protected boolean isTablePerClass() {
- return AbstractOrmEntity.this.isTablePerClass();
- }
-
- protected JavaEntity getJavaEntityForDefaults() {
- return AbstractOrmEntity.this.getJavaTypeMappingForDefaults();
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java
deleted file mode 100644
index b6fe73f53c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java
+++ /dev/null
@@ -1,245 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.context.Generator;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> 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());
- }
-
-
- // ********** 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;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- if (StringTools.stringIsEmpty(this.name)){
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.GENERATOR_NAME_UNDEFINED,
- EMPTY_STRING_ARRAY,
- this,
- this.getNameTextRange()
- )
- );
- }
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlGenerator.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange(this.xmlGenerator.getNameTextRange());
- }
-
-
- // ********** 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 **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public X getXmlGenerator() {
- return this.xmlGenerator;
- }
-
- public boolean overrides(Generator other) {
- return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST);
- }
-
- public boolean duplicates(Generator other) {
- return MappingTools.nodesAreDuplicates(this, other);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java
deleted file mode 100644
index b41cf8db22..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java
+++ /dev/null
@@ -1,499 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.IdMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> ID mapping
- */
-public abstract class AbstractOrmIdMapping<X extends XmlId>
- extends AbstractOrmAttributeMapping<X>
- implements OrmIdMapping, IdMapping2_0
-{
- protected final OrmColumn column;
-
- protected final OrmGeneratorContainer generatorContainer;
-
- protected OrmGeneratedValue generatedValue;
-
- protected OrmConverter converter; // never null
-
- /* JPA 2.0 - the embedded id may be derived from a relationship */
- protected boolean derived;
-
-
- 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.setDerived(this.buildDerived());
- }
-
-
- // ********** 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;
- }
-
-
- // ********** derived **********
-
- public boolean isDerived() {
- return this.derived;
- }
-
- protected void setDerived(boolean derived) {
- boolean old = this.derived;
- this.derived = derived;
- this.firePropertyChanged(DERIVED_PROPERTY, old, derived);
- }
-
- protected boolean buildDerived() {
- return this.isJpa2_0Compatible() && this.buildDerived_();
- }
-
- protected boolean buildDerived_() {
- return this.getTypeMapping().attributeIsDerivedId(this.name);
- }
-
-
- // ********** 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.derived && ! this.isColumnSpecified()) ? null : this.name;
- }
-
- public String getDefaultTableName() {
- return (this.derived && ! 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 Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- 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,
- // the column is validated.
- // JPA 1.0: The column is always be validated, since the ID is never mapped by a
- // relationship.
- if (this.isColumnSpecified() || ! this.derived) {
- this.column.validate(messages, reporter);
- }
-
- // JPA 2.0: If the column is specified and the ID is mapped by a relationship,
- // we have an error.
- // JPA 1.0: The ID cannot be mapped by a relationship.
- if (this.isColumnSpecified() && this.derived) {
- messages.add(this.buildColumnSpecifiedAndDerivedMessage());
- }
-
- if (this.generatedValue != null) {
- this.generatedValue.validate(messages, reporter);
- }
- this.generatorContainer.validate(messages, reporter);
- this.converter.validate(messages, reporter);
- }
-
- protected IMessage buildColumnSpecifiedAndDerivedMessage() {
- 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 JpaValidationDescriptionMessages.ATTRIBUTE_DESC;
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 29a0097be1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,291 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmJoinColumnRelationshipStrategy
- extends AbstractOrmXmlContextNode
- implements OrmJoinColumnRelationshipStrategy
-{
- protected final ContextListContainer<OrmJoinColumn, XmlJoinColumn> specifiedJoinColumnContainer;
- protected final OrmReadOnlyJoinColumn.Owner joinColumnOwner;
-
- protected OrmJoinColumn defaultJoinColumn;
-
-
- protected AbstractOrmJoinColumnRelationshipStrategy(OrmJoinColumnRelationship parent) {
- super(parent);
- this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
- this.joinColumnOwner = this.buildJoinColumnOwner();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSpecifiedJoinColumns();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(getSpecifiedJoinColumns());
- this.updateDefaultJoinColumn();
- }
-
-
- // ********** XML join column container **********
-
- protected XmlJoinColumnContainer getXmlJoinColumnContainer() {
- return this.getRelationship().getXmlContainer();
- }
-
-
- // ********** join columns **********
-
- public ListIterable<OrmJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int getJoinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
- return this.specifiedJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- return this.specifiedJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.getSpecifiedJoinColumnsSize() != 0;
- }
-
- public OrmJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumnContainer.getContextElement(index);
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.getSpecifiedJoinColumnsSize());
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn(int index) {
- XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
- OrmJoinColumn joinColumn = this.specifiedJoinColumnContainer.addContextElement(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.specifiedJoinColumnContainer.indexOfContextElement((OrmJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- this.specifiedJoinColumnContainer.removeContextElement(index);
- this.getXmlJoinColumnContainer().getJoinColumns().remove(index);
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- this.specifiedJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- this.getXmlJoinColumnContainer().getJoinColumns().move(targetIndex, sourceIndex);
- }
-
- protected void syncSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlJoinColumn> getXmlJoinColumns() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlJoinColumn>(this.getXmlJoinColumnContainer().getJoinColumns());
- }
-
- protected ContextListContainer<OrmJoinColumn, XmlJoinColumn> buildSpecifiedJoinColumnContainer() {
- return new SpecifiedJoinColumnContainer();
- }
-
- /**
- * specified join column container
- */
- protected class SpecifiedJoinColumnContainer
- extends ContextListContainer<OrmJoinColumn, XmlJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmJoinColumn buildContextElement(XmlJoinColumn resourceElement) {
- return AbstractOrmJoinColumnRelationshipStrategy.this.buildJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<XmlJoinColumn> getResourceElements() {
- return AbstractOrmJoinColumnRelationshipStrategy.this.getXmlJoinColumns();
- }
- @Override
- protected XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- }
-
- protected abstract OrmReadOnlyJoinColumn.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 : oldStrategy.getSpecifiedJoinColumns()) {
- this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
- }
- }
-
- public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy virtualStrategy) {
- for (ReadOnlyJoinColumn joinColumn : virtualStrategy.getJoinColumns()) {
- 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 Iterable<String> getCandidateTableNames() {
- TypeMapping typeMapping = this.getRelationshipSource();
- return (typeMapping != null) ? typeMapping.getAllAssociatedTableNames() : EmptyIterable.<String>instance();
- }
-
- public void addStrategy() {
- if (this.getSpecifiedJoinColumnsSize() == 0) {
- this.addSpecifiedJoinColumn();
- }
- }
-
- public void removeStrategy() {
- for (int i = this.getSpecifiedJoinColumnsSize(); i-- > 0; ) {
- this.removeSpecifiedJoinColumn(i);
- }
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- for (OrmJoinColumn joinColumn : this.getJoinColumns()) {
- joinColumn.validate(messages, reporter);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java
deleted file mode 100644
index a84fd271ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmJoinTableRelationshipStrategy
- extends AbstractOrmXmlContextNode
- implements OrmJoinTableRelationshipStrategy, ReadOnlyTable.Owner
-{
- protected OrmJoinTable joinTable;
-
-
- protected AbstractOrmJoinTableRelationshipStrategy(OrmJoinTableRelationship parent) {
- super(parent);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- if (this.joinTable != null) {
- this.joinTable.synchronizeWithResourceModel();
- }
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJoinTable();
- }
-
-
- // ********** join table **********
-
- public OrmJoinTable getJoinTable() {
- return this.joinTable;
- }
-
- protected void setJoinTable(OrmJoinTable joinTable) {
- OrmJoinTable old = this.joinTable;
- this.joinTable = joinTable;
- this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable);
- }
-
- protected void updateJoinTable() {
- if (this.buildsJoinTable()) {
- if (this.joinTable == null) {
- this.setJoinTable(this.buildJoinTable());
- } else {
- this.joinTable.update();
- }
- } else {
- if (this.joinTable != null) {
- this.setJoinTable(null);
- }
- }
- }
-
- /**
- * The strategy can have a join table if either the XML table is present
- * or the [mapping] relationship supports a default join table.
- */
- protected boolean buildsJoinTable() {
- return (this.getXmlJoinTable() != null) ||
- this.getRelationship().mayHaveDefaultJoinTable();
- }
-
- protected OrmJoinTable buildJoinTable() {
- return this.getContextNodeFactory().buildOrmJoinTable(this, this);
- }
-
-
- // ********** XML join table **********
-
- public XmlJoinTable getXmlJoinTable() {
- return this.getXmlJoinTableContainer().getJoinTable();
- }
-
- public XmlJoinTable buildXmlJoinTable() {
- XmlJoinTable xmlJoinTable = OrmFactory.eINSTANCE.createXmlJoinTable();
- this.getXmlJoinTableContainer().setJoinTable(xmlJoinTable);
- return xmlJoinTable;
- }
-
- public void removeXmlJoinTable() {
- this.getXmlJoinTableContainer().setJoinTable(null);
- }
-
- protected XmlJoinTableContainer getXmlJoinTableContainer() {
- return this.getRelationship().getXmlContainer();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.joinTable != null) {
- this.joinTable.validate(messages, reporter);
- }
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmJoinTableRelationship getParent() {
- return (OrmJoinTableRelationship) super.getParent();
- }
-
- public OrmJoinTableRelationship getRelationship() {
- return this.getParent();
- }
-
- protected RelationshipMapping getRelationshipMapping() {
- return this.getRelationship().getMapping();
- }
-
- public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) {
- ReadOnlyJoinTable oldJoinTable = oldStrategy.getJoinTable();
- if (oldJoinTable != null) {
- this.addStrategy();
- this.joinTable.initializeFrom(oldJoinTable);
- }
- }
-
- public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) {
- ReadOnlyJoinTable oldJoinTable = virtualStrategy.getJoinTable();
- if (oldJoinTable != null) {
- this.addStrategy();
- this.joinTable.initializeFromVirtual(oldJoinTable);
- }
- }
-
- public String getTableName() {
- return (this.joinTable == null) ? null : this.joinTable.getName();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return (this.joinTable == null) ? null : this.joinTable.getDbTable();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return Tools.valuesAreDifferent(this.getTableName(), tableName);
- }
-
- public String getColumnTableNotValidDescription() {
- return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE;
- }
-
- public String getJoinTableDefaultName() {
- return MappingTools.buildJoinTableDefaultName(this.getRelationship());
- }
-
- public void addStrategy() {
- if (this.joinTable == null) {
- this.setJoinTable(this.buildJoinTable());
- this.buildXmlJoinTable();
- }
- }
-
- public void removeStrategy() {
- if (this.joinTable != null) {
- this.setJoinTable(null);
- this.removeXmlJoinTable();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java
deleted file mode 100644
index e131cef90a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToManyMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
-
-public abstract class AbstractOrmManyToManyMapping<X extends XmlManyToMany>
- extends AbstractOrmMultiRelationshipMapping<X>
- implements OrmManyToManyMapping2_0
-{
- protected AbstractOrmManyToManyMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- }
-
-
- // ********** relationship **********
-
- @Override
- public OrmManyToManyRelationship getRelationship() {
- return (OrmManyToManyRelationship) super.getRelationship();
- }
-
- @Override
- protected OrmMappingRelationship buildRelationship() {
- return new GenericOrmManyToManyRelationship(this);
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 70;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmManyToManyMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
- resourceAttributes.getManyToManys().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
- resourceAttributes.getManyToManys().remove(this.xmlAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java
deleted file mode 100644
index d5927bd21d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneRelationship2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
-
-/**
- * <code>orm.xml</code> 1:1 mapping
- */
-public abstract class AbstractOrmManyToOneMapping<X extends XmlManyToOne>
- extends AbstractOrmSingleRelationshipMapping<X>
- implements OrmManyToOneMapping2_0
-{
- protected AbstractOrmManyToOneMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- }
-
-
- // ********** relationship **********
-
- @Override
- protected OrmManyToOneRelationship2_0 buildRelationship() {
- return new GenericOrmManyToOneRelationship(this);
- }
-
- @Override
- public OrmManyToOneRelationship2_0 getRelationship() {
- return (OrmManyToOneRelationship2_0) super.getRelationship();
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 40;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmManyToOneMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
- resourceAttributes.getManyToOnes().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
- resourceAttributes.getManyToOnes().remove(this.xmlAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java
deleted file mode 100644
index c2c3ee2a22..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java
+++ /dev/null
@@ -1,213 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericMappedSuperclassPrimaryKeyValidator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> mapped superclass
- */
-public abstract class AbstractOrmMappedSuperclass<X extends XmlMappedSuperclass>
- extends AbstractOrmTypeMapping<X>
- implements OrmMappedSuperclass, OrmIdClassReference.Owner
-{
- protected final OrmIdClassReference idClassReference;
-
-
- protected AbstractOrmMappedSuperclass(OrmPersistentType parent, X xmlMappedSuperclass) {
- super(parent, xmlMappedSuperclass);
- this.idClassReference = this.buildIdClassReference();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.idClassReference.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.idClassReference.update();
- }
-
-
- // ********** key **********
-
- public String getKey() {
- return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
-
- // ********** id class **********
-
- public OrmIdClassReference getIdClassReference() {
- return this.idClassReference;
- }
-
- protected OrmIdClassReference buildIdClassReference() {
- return new GenericOrmIdClassReference(this, this);
- }
-
- public JavaPersistentType getIdClass() {
- return this.idClassReference.getIdClass();
- }
-
- public XmlIdClassContainer getXmlIdClassContainer() {
- return this.getXmlTypeMapping();
- }
-
- public JavaIdClassReference getJavaIdClassReferenceForDefaults() {
- JavaMappedSuperclass javaMappedSuperclass = this.getJavaTypeMappingForDefaults();
- return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getIdClassReference();
- }
-
-
- // ********** entity mappings **********
-
- public int getXmlSequence() {
- return 0;
- }
-
- public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) {
- entityMappings.getMappedSuperclasses().add(this.xmlTypeMapping);
- }
-
- public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) {
- entityMappings.getMappedSuperclasses().remove(this.xmlTypeMapping);
- }
-
-
- // ********** Java **********
-
- @Override
- public JavaMappedSuperclass getJavaTypeMapping() {
- return (JavaMappedSuperclass) super.getJavaTypeMapping();
- }
-
- @Override
- public JavaMappedSuperclass getJavaTypeMappingForDefaults() {
- return (JavaMappedSuperclass) super.getJavaTypeMappingForDefaults();
- }
-
-
- // ********** tables **********
-
- public Iterable<ReadOnlyTable> getAssociatedTables() {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReadOnlyTable> getAllAssociatedTables() {
- return EmptyIterable.instance();
- }
-
- public Iterable<String> getAllAssociatedTableNames() {
- return EmptyIterable.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);
- this.idClassReference.validate(messages, reporter);
- }
-
- @Override
- public boolean validatesAgainstDatabase() {
- return false;
- }
-
- protected void validatePrimaryKey(List<IMessage> messages, IReporter reporter) {
- this.buildPrimaryKeyValidator().validate(messages, reporter);
- }
-
- protected JptValidator buildPrimaryKeyValidator() {
- return new GenericMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver());
- // TODO - JPA 2.0 validation
- }
-
- @Override
- protected PrimaryKeyTextRangeResolver buildTextRangeResolver() {
- return new OrmMappedSuperclassTextRangeResolver(this);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java
deleted file mode 100644
index b0387bc002..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping;
-
-/**
- * <strong>NB:</strong> Subclasses will want to set the {@link #strategy} at the
- * end of their constructors; otherwise, it will be <code>null</code> until it
- * is set during {@link #update()}.
- */
-public abstract class AbstractOrmMappingRelationship<M extends OrmRelationshipMapping>
- extends AbstractOrmXmlContextNode
- implements OrmMappingRelationship
-{
- protected OrmMappingRelationshipStrategy2_0 strategy;
-
-
- protected AbstractOrmMappingRelationship(M parent) {
- super(parent);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateStrategy();
- }
-
-
- // ********** strategy **********
-
- public OrmMappingRelationshipStrategy2_0 getStrategy() {
- return this.strategy;
- }
-
- protected void setStrategy(OrmMappingRelationshipStrategy2_0 strategy) {
- RelationshipStrategy old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- protected abstract OrmMappingRelationshipStrategy2_0 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 false;
- }
-
- public boolean isTargetForeignKey() {
- return false;
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getMapping().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
deleted file mode 100644
index eabf1c41cd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ /dev/null
@@ -1,801 +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.jpa.core.internal.context.orm;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMultiRelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.MapKey;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> multi-relationship (1:m, m:m) mapping
- */
-public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlMultiRelationshipMapping>
- extends AbstractOrmRelationshipMapping<X>
- implements OrmMultiRelationshipMapping, OrmCollectionMapping2_0
-{
- protected final OrmOrderable orderable;
-
- protected String specifiedMapKey;
- protected boolean noMapKey = false;
- protected boolean pkMapKey = false;
- protected boolean customMapKey = false;
-
- protected String specifiedMapKeyClass;
- protected String defaultMapKeyClass;
-
- protected Type valueType;
- protected Type keyType;
-
- protected final OrmColumn mapKeyColumn;
-
- protected final OrmAttributeOverrideContainer mapKeyAttributeOverrideContainer;
-
-
- protected AbstractOrmMultiRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.orderable = this.buildOrderable();
-
- this.specifiedMapKey = this.buildSpecifiedMapKey();
- this.noMapKey = this.buildNoMapKey();
- this.pkMapKey = this.buildPkMapKey();
- this.customMapKey = this.buildCustomMapKey();
-
- this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass();
-
- this.mapKeyColumn = this.buildMapKeyColumn();
- this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.orderable.synchronizeWithResourceModel();
-
- this.setSpecifiedMapKey_(this.buildSpecifiedMapKey());
- this.setNoMapKey_(this.buildNoMapKey());
- this.setPkMapKey_(this.buildPkMapKey());
- this.setCustomMapKey_(this.buildCustomMapKey());
-
- this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass());
-
- this.mapKeyColumn.synchronizeWithResourceModel();
-
- this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
-
- this.orderable.update();
-
- this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
-
- this.setValueType(this.buildValueType());
- this.setKeyType(this.buildKeyType());
-
- this.mapKeyColumn.update();
-
- this.mapKeyAttributeOverrideContainer.update();
- }
-
-
- // ********** orderable **********
-
- public OrmOrderable getOrderable() {
- return this.orderable;
- }
-
- protected OrmOrderable buildOrderable() {
- return this.isOrmXml2_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 Iterable<String> getCandidateMapKeyNames() {
- return this.getAllTargetEntityAttributeNames();
- }
-
-
- // ********** 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 Iterable<String> getCandidateTableNames() {
- return EmptyIterable.instance();
- }
-
- public TextRange getValidationTextRange() {
- return AbstractOrmMultiRelationshipMapping.this.getValidationTextRange();
- }
-
- protected OrmRelationshipStrategy getRelationshipStrategy() {
- return AbstractOrmMultiRelationshipMapping.this.getRelationship().getStrategy();
- }
-
- protected OrmPersistentAttribute getPersistentAttribute() {
- return AbstractOrmMultiRelationshipMapping.this.getPersistentAttribute();
- }
- }
-
-
- // ********** map key column owner **********
-
- protected class MapKeyColumnOwner
- extends AbstractOwner
- implements OrmColumn.Owner
- {
- public String getDefaultColumnName() {
- return AbstractOrmMultiRelationshipMapping.this.getName() + "_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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new MapKeyColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) 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 Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? overriddenTypeMapping.getAllOverridableAttributeNames() : EmptyIterable.<String>instance();
- }
-
- protected JavaAttributeOverride getSpecifiedJavaAttributeOverrideNamed(String attributeName) {
- return AbstractOrmMultiRelationshipMapping.this.getSpecifiedJavaMapKeyAttributeOverrideNamed(attributeName);
- }
-
- public Iterable<String> getJavaOverrideNames() {
- return null;
- }
-
- public EList<XmlAttributeOverride> getXmlOverrides() {
- return AbstractOrmMultiRelationshipMapping.this.xmlAttributeMapping.getMapKeyAttributeOverrides();
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- 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 buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, column, textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy()));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java
deleted file mode 100644
index 303ed9a645..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java
+++ /dev/null
@@ -1,289 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code><ul>
- * <li>column
- * <li>join column
- * <li>discriminator column
- * <li>order column
- * <li>primary key join column
- * </ul>
- * <strong>NB:</strong> any subclass that directly holds its XML column must:<ul>
- * <li>call the "super" constructor that takes an XML column
- * {@link #AbstractOrmNamedColumn(XmlContextNode, OrmReadOnlyNamedColumn.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 OrmReadOnlyNamedColumn.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() {
- TextRange textRange = this.getXmlColumnTextRange();
- return (textRange != null) ? textRange : this.owner.getValidationTextRange();
- }
-
- protected TextRange getXmlColumnTextRange() {
- X xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange(this.getXmlColumnNameTextRange());
- }
-
- protected TextRange getXmlColumnNameTextRange() {
- X xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getNameTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- /**
- * This is used by the subclasses that implement {@link ReadOnlyBaseJoinColumn#isVirtual()}.
- */
- public boolean isVirtual() {
- return false;
- }
-
- protected void initializeFrom(ReadOnlyNamedColumn oldColumn) {
- this.setSpecifiedName(oldColumn.getSpecifiedName());
- this.setColumnDefinition(oldColumn.getColumnDefinition());
- }
-
- protected void initializeFromVirtual(ReadOnlyNamedColumn virtualColumn) {
- this.setSpecifiedName(virtualColumn.getName());
- this.setColumnDefinition(virtualColumn.getColumnDefinition());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- String table = this.getTable();
- if (table != null) {
- sb.append(table);
- sb.append('.');
- }
- sb.append(this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumnTextRangeResolver.java
deleted file mode 100644
index 73f81db31f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumnTextRangeResolver.java
+++ /dev/null
@@ -1,30 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-
-public abstract class AbstractOrmNamedColumnTextRangeResolver<C extends OrmReadOnlyNamedColumn>
- implements NamedColumnTextRangeResolver
-{
- protected final C column;
-
-
- protected AbstractOrmNamedColumnTextRangeResolver(C column) {
- super();
- this.column = column;
- }
-
- public TextRange getNameTextRange() {
- return this.column.getNameTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java
deleted file mode 100644
index f4a7c7a7c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
-
-
-public abstract class AbstractOrmOneToManyMapping<X extends XmlOneToMany>
- extends AbstractOrmMultiRelationshipMapping<X>
- implements OrmOneToManyMapping2_0, OrmOrphanRemovalHolder2_0
-{
- protected final OrmOrphanRemovable2_0 orphanRemoval;
-
-
- protected AbstractOrmOneToManyMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.orphanRemoval = this.buildOrphanRemoval();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.orphanRemoval.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.orphanRemoval.update();
- }
-
-
- // ********** orphan removal **********
-
- public OrmOrphanRemovable2_0 getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- protected OrmOrphanRemovable2_0 buildOrphanRemoval() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmOrphanRemoval(this) :
- new NullOrmOrphanRemoval2_0(this);
- }
-
-
- // ********** relationship **********
-
- @Override
- protected OrmOneToManyRelationship2_0 buildRelationship() {
- return new GenericOrmOneToManyRelationship(this, this.isJpa2_0Compatible());
- }
-
- @Override
- public OrmOneToManyRelationship2_0 getRelationship() {
- return (OrmOneToManyRelationship2_0) super.getRelationship();
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 50;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmOneToManyMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
- resourceAttributes.getOneToManys().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
- resourceAttributes.getOneToManys().remove(this.xmlAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java
deleted file mode 100644
index 4302119c3d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
-
-/**
- * <code>orm.xml</code> 1:1 mapping
- */
-public abstract class AbstractOrmOneToOneMapping<X extends XmlOneToOne>
- extends AbstractOrmSingleRelationshipMapping<X>
- implements OrmOneToOneMapping2_0, OrmOrphanRemovalHolder2_0
-{
- protected final OrmOrphanRemovable2_0 orphanRemoval;
-
-
- protected AbstractOrmOneToOneMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.orphanRemoval = this.buildOrphanRemoval();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.orphanRemoval.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.orphanRemoval.update();
- }
-
-
- // ********** orphan removal **********
-
- public OrmOrphanRemovable2_0 getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- protected OrmOrphanRemovable2_0 buildOrphanRemoval() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmOrphanRemoval(this) :
- new NullOrmOrphanRemoval2_0(this);
- }
-
-
- // ********** relationship **********
-
- @Override
- public OrmOneToOneRelationship2_0 getRelationship() {
- return (OrmOneToOneRelationship2_0) super.getRelationship();
- }
-
- @Override
- protected OrmMappingRelationship buildRelationship() {
- return new GenericOrmOneToOneRelationship(this);
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 60;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmOneToOneMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
- resourceAttributes.getOneToOnes().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
- resourceAttributes.getOneToOnes().remove(this.xmlAttributeMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java
deleted file mode 100644
index 958060d508..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.Query;
-import org.eclipse.jpt.jpa.core.context.QueryHint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <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 ContextListContainer<OrmQueryHint, XmlQueryHint> queryHintContainer;
-
-
- protected AbstractOrmQuery(XmlContextNode parent, X xmlQuery) {
- super(parent);
- this.xmlQuery = xmlQuery;
- this.name = xmlQuery.getName();
- this.query = this.getUnescapedQuery();
- this.queryHintContainer = this.buildHintContainer();
- }
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setName_(this.xmlQuery.getName());
- this.setQuery_(this.getUnescapedQuery());
- this.syncHints();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(this.getHints());
- }
-
-
- // ********** 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(this.convertToEscapeQuery(query));
- }
-
- protected void setQuery_(String query) {
- String old = this.query;
- this.query = query;
- this.firePropertyChanged(QUERY_PROPERTY, old, query);
- }
-
- protected String getUnescapedQuery() {
- String queryString = this.xmlQuery.getQuery();
- if (StringTools.stringIsNotEmpty(queryString)) {
- queryString = ExpressionTools.unescape(queryString, new int[1]);
- }
- return queryString;
- }
-
- // TODO bjv add method to ExpressionTools?
- protected String convertToEscapeQuery(String queryString) {
- if (StringTools.stringIsNotEmpty(queryString)) {
- queryString = ExpressionTools.escape(queryString, new int[1]);
- }
- return queryString;
- }
-
-
- // ********** hints **********
-
- public ListIterable<OrmQueryHint> getHints() {
- return this.queryHintContainer.getContextElements();
- }
-
- public int getHintsSize() {
- return this.queryHintContainer.getContextElementsSize();
- }
-
- public OrmQueryHint addHint() {
- return this.addHint(this.getHintsSize());
- }
-
- public OrmQueryHint addHint(int index) {
- XmlQueryHint xmlHint = this.buildXmlQueryHint();
- OrmQueryHint hint = this.queryHintContainer.addContextElement(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.queryHintContainer.indexOfContextElement((OrmQueryHint) hint));
- }
-
- public void removeHint(int index) {
- this.queryHintContainer.removeContextElement(index);
- this.xmlQuery.getHints().remove(index);
- }
-
- public void moveHint(int targetIndex, int sourceIndex) {
- this.queryHintContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlQuery.getHints().move(targetIndex, sourceIndex);
- }
-
- protected OrmQueryHint buildHint(XmlQueryHint xmlHint) {
- return this.getContextNodeFactory().buildOrmQueryHint(this, xmlHint);
- }
-
- protected void syncHints() {
- this.queryHintContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlQueryHint> getXmlHints() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlQueryHint>(this.xmlQuery.getHints());
- }
-
- protected ContextListContainer<OrmQueryHint, XmlQueryHint> buildHintContainer() {
- return new HintContainer();
- }
-
- /**
- * query hint container
- */
- protected class HintContainer
- extends ContextListContainer<OrmQueryHint, XmlQueryHint>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return HINTS_LIST;
- }
- @Override
- protected OrmQueryHint buildContextElement(XmlQueryHint resourceElement) {
- return AbstractOrmQuery.this.buildHint(resourceElement);
- }
- @Override
- protected ListIterable<XmlQueryHint> getResourceElements() {
- return AbstractOrmQuery.this.getXmlHints();
- }
- @Override
- protected XmlQueryHint getResourceElement(OrmQueryHint contextElement) {
- return contextElement.getXmlQueryHint();
- }
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateName(messages);
- this.validateQuery(messages, reporter);
- }
-
- protected void validateName(List<IMessage> messages) {
- if (StringTools.stringIsEmpty(this.name)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.QUERY_NAME_UNDEFINED,
- EMPTY_STRING_ARRAY,
- this,
- this.getNameTextRange()
- )
- );
- }
- }
-
- protected void validateQuery(List<IMessage> messages, IReporter reporter) {
- if (StringTools.stringIsEmpty(this.query)){
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.QUERY_STATEMENT_UNDEFINED,
- new String[] {this.name},
- this,
- this.getNameTextRange()
- )
- );
- } else {
- this.validateQuery_(messages, reporter);
- }
- }
-
- protected abstract void validateQuery_(List<IMessage> messages, IReporter reporter);
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlQuery.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange(this.xmlQuery.getNameTextRange());
- }
-
- public TextRange getQueryTextRange() {
- return this.getValidationTextRange(this.xmlQuery.getQueryTextRange());
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- 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);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java
deleted file mode 100644
index caa97f18dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import java.util.Vector;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyUniqueConstraint;
-
-public abstract class AbstractOrmReadOnlyUniqueConstraint
- extends AbstractOrmXmlContextNode
- implements OrmReadOnlyUniqueConstraint
-{
- protected final Vector<String> columnNames = new Vector<String>();
-
-
- public AbstractOrmReadOnlyUniqueConstraint(XmlContextNode parent) {
- super(parent);
- }
-
-
- // ********** column names **********
-
- public Iterable<String> getColumnNames() {
- return new LiveCloneListIterable<String>(this.columnNames);
- }
-
- public int getColumnNamesSize() {
- return this.columnNames.size();
- }
-
- public String getColumnName(int index) {
- return this.columnNames.get(index);
- }
-
- protected void syncColumnNames() {
- this.synchronizeList(this.getResourceColumnNames(), this.columnNames, COLUMN_NAMES_LIST);
- }
-
- protected abstract Iterable<String> getResourceColumnNames();
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.columnNames);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
deleted file mode 100644
index 156abf1809..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
+++ /dev/null
@@ -1,396 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmCascade;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmCascade;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> relationship mapping (1:1, 1:m, m:1, m:m)
- */
-public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelationshipMapping>
- extends AbstractOrmAttributeMapping<X>
- implements OrmRelationshipMapping
-{
- protected String specifiedTargetEntity;
- protected String defaultTargetEntity;
-
- protected final OrmMappingRelationship relationship;
-
- protected final OrmCascade cascade;
-
- protected FetchType specifiedFetch;
- protected FetchType defaultFetch;
-
-
- protected AbstractOrmRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.specifiedTargetEntity = xmlMapping.getTargetEntity();
- this.relationship = this.buildRelationship();
- this.cascade = this.buildCascade();
- this.specifiedFetch = this.buildSpecifiedFetch();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedTargetEntity_(this.xmlAttributeMapping.getTargetEntity());
- this.relationship.synchronizeWithResourceModel();
- this.cascade.synchronizeWithResourceModel();
- this.setSpecifiedFetch_(this.buildSpecifiedFetch());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultTargetEntity(this.buildDefaultTargetEntity());
- this.relationship.update();
- this.cascade.update();
- this.setDefaultFetch(this.buildDefaultFetch());
- }
-
-
- // ********** target entity **********
-
- public String getTargetEntity() {
- return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity;
- }
-
- public String getSpecifiedTargetEntity() {
- return this.specifiedTargetEntity;
- }
-
- public void setSpecifiedTargetEntity(String entity) {
- this.setSpecifiedTargetEntity_(entity);
- this.xmlAttributeMapping.setTargetEntity(entity);
- }
-
- protected void setSpecifiedTargetEntity_(String entity) {
- String old = this.specifiedTargetEntity;
- this.specifiedTargetEntity = entity;
- this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, entity);
- }
-
- public String getDefaultTargetEntity() {
- return this.defaultTargetEntity;
- }
-
- protected void setDefaultTargetEntity(String entity) {
- String old = this.defaultTargetEntity;
- this.defaultTargetEntity = entity;
- this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, entity);
- }
-
- protected String buildDefaultTargetEntity() {
- return (this.getJavaPersistentAttribute() == null) ? null : this.getJavaTargetType();
- }
-
- /**
- * pre-condition: the mapping's Java persistent attribute is not
- * <code>null</code>.
- */
- protected abstract String getJavaTargetType();
-
- public Entity getResolvedTargetEntity() {
- TypeMapping typeMapping = this.getResolvedTargetTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- protected TypeMapping getResolvedTargetTypeMapping() {
- PersistentType resolvedTargetType = this.getResolvedTargetType();
- return (resolvedTargetType == null) ? null : resolvedTargetType.getMapping();
- }
-
- // sub-classes like this to be public
- public PersistentType getResolvedTargetType() {
- return this.resolvePersistentType(this.getTargetEntity());
- }
-
- public char getTargetEntityEnclosingTypeSeparator() {
- return '$';
- }
-
-
- // ********** relationship reference **********
-
- public OrmMappingRelationship getRelationship() {
- return this.relationship;
- }
-
- protected abstract OrmMappingRelationship buildRelationship();
-
-
- // ********** cascade **********
-
- public OrmCascade getCascade() {
- return this.cascade;
- }
-
- protected OrmCascade buildCascade() {
- // NB: we don't use the platform
- return new GenericOrmCascade(this);
- }
-
-
- // ********** fetch **********
-
- public FetchType getFetch() {
- return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType fetch) {
- this.setSpecifiedFetch_(fetch);
- this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch));
- }
-
- protected void setSpecifiedFetch_(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType buildSpecifiedFetch() {
- return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch());
- }
-
- public FetchType getDefaultFetch() {
- return this.defaultFetch;
- }
-
- protected void setDefaultFetch(FetchType fetch) {
- FetchType old = this.defaultFetch;
- this.defaultFetch = fetch;
- this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
- }
-
- protected abstract FetchType buildDefaultFetch();
-
-
- // ********** misc **********
-
- @Override
- public boolean isRelationshipOwner() {
- return this.relationship.isOwner();
- }
-
- @Override
- public boolean isOwnedBy(AttributeMapping mapping) {
- return mapping.isRelationshipOwner() &&
- this.relationship.isOwnedBy((RelationshipMapping) mapping);
- }
-
- public RelationshipMapping getRelationshipOwner() {
- Entity entity = this.getResolvedTargetEntity();
- if (entity == null) {
- return null;
- }
- for (ReadOnlyPersistentAttribute attribute : entity.getPersistentType().getAllAttributes()) {
- 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 Iterable<String> getAllTargetEntityAttributeNames() {
- return new CompositeIterable<String>(this.getAllTargetEntityAttributeNamesLists());
- }
-
- protected Iterable<Iterable<String>> getAllTargetEntityAttributeNamesLists() {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getAllTargetEntityAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<AttributeMapping> getAllTargetEntityAttributeMappings() {
- Entity entity = this.getResolvedTargetEntity();
- return (entity != null) ? entity.getAllAttributeMappings() : EmptyIterable.<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) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED,
- new String[] {this.name},
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
- if (this.getResolvedTargetEntity() == null) {
- 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 getTargetEntityTextRange() {
- return this.getValidationTextRange(this.xmlAttributeMapping.getTargetEntityTextRange());
- }
-
-
- // ********** metamodel **********
-
- @Override
- public String getMetamodelTypeName() {
- PersistentType resolvedTargetType = this.getResolvedTargetType();
- if (resolvedTargetType == null) {
- return MetamodelField.DEFAULT_TYPE_NAME;
- }
- String targetTypeName = resolvedTargetType.getName();
- return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java
deleted file mode 100644
index ee4611f4f6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-
-/**
- * <code>orm.xml</code> sequence generator
- */
-public abstract class AbstractOrmSequenceGenerator
- extends AbstractOrmGenerator<XmlSequenceGenerator>
- implements OrmSequenceGenerator
-{
- protected String specifiedSequenceName;
- protected String defaultSequenceName;
-
-
- protected AbstractOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) {
- super(parent, xmlSequenceGenerator);
- this.specifiedSequenceName = xmlSequenceGenerator.getSequenceName();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedSequenceName_(this.xmlGenerator.getSequenceName());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultSequenceName(this.buildDefaultSequenceName());
- }
-
-
- // ********** initial value **********
-
- @Override
- protected int buildDefaultInitialValue() {
- return DEFAULT_INITIAL_VALUE;
- }
-
-
- // ********** sequence name **********
-
- public String getSequenceName() {
- return (this.specifiedSequenceName != null) ? this.specifiedSequenceName : this.defaultSequenceName;
- }
-
- public String getSpecifiedSequenceName() {
- return this.specifiedSequenceName;
- }
-
- public void setSpecifiedSequenceName(String specifiedSequenceName) {
- this.setSpecifiedSequenceName_(specifiedSequenceName);
- this.xmlGenerator.setSequenceName(specifiedSequenceName);
- }
-
- protected void setSpecifiedSequenceName_(String specifiedSequenceName) {
- String old = this.specifiedSequenceName;
- this.specifiedSequenceName = specifiedSequenceName;
- this.firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, old, specifiedSequenceName);
- }
-
- public String getDefaultSequenceName() {
- return this.defaultSequenceName;
- }
-
- protected void setDefaultSequenceName(String defaultSequenceName) {
- String old = this.defaultSequenceName;
- this.defaultSequenceName = defaultSequenceName;
- this.firePropertyChanged(DEFAULT_SEQUENCE_NAME_PROPERTY, old, defaultSequenceName);
- }
-
- protected String buildDefaultSequenceName() {
- return null; // TODO the default sequence name is determined by the runtime provider...
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
deleted file mode 100644
index bde41315e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java
+++ /dev/null
@@ -1,141 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSingleRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> single relationship mapping (1:1, m:1)
- */
-public abstract class AbstractOrmSingleRelationshipMapping<X extends AbstractXmlSingleRelationshipMapping>
- extends AbstractOrmRelationshipMapping<X>
- implements OrmSingleRelationshipMapping2_0
-{
- protected Boolean specifiedOptional;
- protected boolean defaultOptional;
-
- protected final OrmDerivedIdentity2_0 derivedIdentity;
-
-
- protected AbstractOrmSingleRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.specifiedOptional = xmlMapping.getOptional();
- this.derivedIdentity = this.buildDerivedIdentity();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedOptional_(this.xmlAttributeMapping.getOptional());
- this.derivedIdentity.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultOptional(this.buildDefaultOptional());
- this.derivedIdentity.update();
- }
-
-
- // ********** optional **********
-
- public boolean isOptional() {
- return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.defaultOptional;
- }
-
- public Boolean getSpecifiedOptional() {
- return this.specifiedOptional;
- }
-
- public void setSpecifiedOptional(Boolean optional) {
- this.setSpecifiedOptional_(optional);
- this.xmlAttributeMapping.setOptional(optional);
- }
-
- protected void setSpecifiedOptional_(Boolean optional) {
- Boolean old = this.specifiedOptional;
- this.specifiedOptional = optional;
- this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional);
- }
-
- public boolean isDefaultOptional() {
- return this.defaultOptional;
- }
-
- protected void setDefaultOptional(boolean optional) {
- boolean old = this.defaultOptional;
- this.defaultOptional = optional;
- this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional);
- }
-
- protected boolean buildDefaultOptional() {
- return DEFAULT_OPTIONAL;
- }
-
-
- // ********** derived identity **********
-
- public OrmDerivedIdentity2_0 getDerivedIdentity() {
- return this.derivedIdentity;
- }
-
- protected OrmDerivedIdentity2_0 buildDerivedIdentity() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmDerivedIdentity(this) :
- new NullOrmDerivedIdentity2_0(this);
- }
-
-
- // ********** misc **********
-
- @Override
- protected void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) {
- super.initializeFromOrmSingleRelationshipMapping(oldMapping);
- if (this.isJpa2_0Compatible()) {
- this.derivedIdentity.initializeFrom(((OrmSingleRelationshipMapping2_0) oldMapping).getDerivedIdentity());
- }
- }
-
- /**
- * pre-condition: the mapping's Java persistent attribute is not
- * <code>null</code>.
- */
- @Override
- protected String getJavaTargetType() {
- return this.getJavaPersistentAttribute().getSingleReferenceTargetTypeName();
- }
-
- @Override
- protected FetchType buildDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.derivedIdentity.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java
deleted file mode 100644
index a5b3997bbd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java
+++ /dev/null
@@ -1,500 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.NameTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> table, secondary table, join table, or collection table
- * <p>
- * <strong>NB:</strong> any subclass that directly holds its XML table must:<ul>
- * <li>call the "super" constructor that takes an XML table
- * {@link #AbstractOrmTable(XmlContextNode, Owner, AbstractXmlTable)}
- * <li>override {@link #setXmlTable(AbstractXmlTable)} to set the XML table
- * so it is in place before the table's state (e.g. {@link #specifiedName})
- * is initialized
- * </ul>
- */
-public abstract class AbstractOrmTable<X extends AbstractXmlTable>
- extends AbstractOrmXmlContextNode
- implements OrmTable, UniqueConstraint.Owner
-{
- protected final Owner owner;
-
- protected String specifiedName;
- protected String defaultName;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected final UniqueConstraintContainer uniqueConstraintContainer;
-
-
- // ********** 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.uniqueConstraintContainer = new UniqueConstraintContainer();
- }
-
-
- // ********** 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 ListIterable<OrmUniqueConstraint> getUniqueConstraints() {
- return this.uniqueConstraintContainer.getContextElements();
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraintContainer.getContextElementsSize();
- }
-
- public OrmUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraintContainer.getContextElement(index);
- }
-
- public OrmUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.getUniqueConstraintsSize());
- }
-
- public OrmUniqueConstraint addUniqueConstraint(int index) {
- X xmlTable = this.getXmlTableForUpdate();
- XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint();
- OrmUniqueConstraint constraint = this.uniqueConstraintContainer.addContextElement(index, xmlConstraint);
- xmlTable.getUniqueConstraints().add(index, xmlConstraint);
- return constraint;
- }
-
- protected XmlUniqueConstraint buildXmlUniqueConstraint() {
- return OrmFactory.eINSTANCE.createXmlUniqueConstraint();
- }
-
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraintContainer.indexOfContextElement((OrmUniqueConstraint) uniqueConstraint));
- }
-
- public void removeUniqueConstraint(int index) {
- this.uniqueConstraintContainer.removeContextElement(index);
- this.getXmlTable().getUniqueConstraints().remove(index);
- this.removeXmlTableIfUnset();
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.uniqueConstraintContainer.moveContextElement(targetIndex, sourceIndex);
- this.getXmlTable().getUniqueConstraints().move(targetIndex, sourceIndex);
- }
-
- protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint xmlConstraint) {
- return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, xmlConstraint);
- }
-
- protected void syncUniqueConstraints() {
- this.uniqueConstraintContainer.synchronizeWithResourceModel();
- }
- protected ListIterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
- X xmlTable = this.getXmlTable();
- return (xmlTable == null) ?
- EmptyListIterable.<XmlUniqueConstraint>instance() :
- // clone to reduce chance of concurrency problems
- new LiveCloneListIterable<XmlUniqueConstraint>(xmlTable.getUniqueConstraints());
- }
-
- /**
- * unique constraint container
- */
- protected class UniqueConstraintContainer
- extends ContextListContainer<OrmUniqueConstraint, XmlUniqueConstraint>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return UNIQUE_CONSTRAINTS_LIST;
- }
- @Override
- protected OrmUniqueConstraint buildContextElement(XmlUniqueConstraint resourceElement) {
- return AbstractOrmTable.this.buildUniqueConstraint(resourceElement);
- }
- @Override
- protected ListIterable<XmlUniqueConstraint> getResourceElements() {
- return AbstractOrmTable.this.getXmlUniqueConstraints();
- }
- @Override
- protected XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
- return contextElement.getXmlUniqueConstraint();
- }
- }
-
-
- // ********** database stuff **********
-
- public org.eclipse.jpt.jpa.db.Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em> catalog),
- * then the database probably does not support catalogs; and we need to
- * get the schema directly from the database.
- */
- public SchemaContainer getDbSchemaContainer() {
- String catalog = this.getCatalog();
- return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase();
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public Catalog getDbCatalog() {
- String catalog = this.getCatalog();
- return (catalog == null) ? null : this.resolveDbCatalog(catalog);
- }
-
- public boolean isResolved() {
- return this.getDbTable() != null;
- }
-
- public boolean schemaIsResolved() {
- return this.getDbSchema() != null;
- }
-
- /**
- * If we don't have a catalog (i.e. we don't even have a <em>default</em>
- * catalog), then the database probably does not support catalogs.
- */
- public boolean catalogIsResolved() {
- String catalog = this.getCatalog();
- return (catalog == null) || (this.resolveDbCatalog(catalog) != null);
- }
-
-
- // ********** UniqueConstraint.Owner implementation **********
-
- public Iterable<String> getCandidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.getSortedColumnIdentifiers() : EmptyIterable.<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() {
- TextRange textRange = this.getXmlTableValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
- protected TextRange getXmlTableValidationTextRange() {
- X xmlTable = this.getXmlTable();
- return (xmlTable == null) ? null : xmlTable.getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange(this.getXmlTableNameTextRange());
- }
-
- protected TextRange getXmlTableNameTextRange() {
- X xmlTable = this.getXmlTable();
- return (xmlTable == null) ? null : xmlTable.getNameTextRange();
- }
-
- public TextRange getSchemaTextRange() {
- return this.getValidationTextRange(this.getXmlTableSchemaTextRange());
- }
-
- protected TextRange getXmlTableSchemaTextRange() {
- X xmlTable = this.getXmlTable();
- return (xmlTable == null) ? null : xmlTable.getSchemaTextRange();
- }
-
- public TextRange getCatalogTextRange() {
- return this.getValidationTextRange(this.getXmlTableCatalogTextRange());
- }
-
- protected TextRange getXmlTableCatalogTextRange() {
- X xmlTable = this.getXmlTable();
- return (xmlTable == null) ? null : xmlTable.getCatalogTextRange();
- }
-
-
- // ********** 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 : oldTable.getUniqueConstraints()) {
- this.addUniqueConstraint().initializeFrom(constraint);
- }
- }
-
- protected void initializeFromVirtual(ReadOnlyTable virtualTable) {
- this.setSpecifiedName(virtualTable.getName());
- // ignore other settings?
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.buildQualifiedName());
- }
-
- protected String buildQualifiedName() {
- return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
deleted file mode 100644
index c2125fd97b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
+++ /dev/null
@@ -1,476 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> type mapping
- */
-public abstract class AbstractOrmTypeMapping<X extends XmlTypeMapping>
- extends AbstractOrmXmlContextNode
- implements OrmTypeMapping
-{
- // never null
- 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 JavaResourceType getJavaResourceType() {
- JavaPersistentType javaType = this.getJavaPersistentType();
- return (javaType == null) ? null : javaType.getJavaResourceType();
- }
-
- 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());
- }
-
- public X getXmlTypeMapping() {
- return this.xmlTypeMapping;
- }
-
- public boolean attributeIsDerivedId(String attributeName) {
- return TypeMappingTools.attributeIsDerivedId(this, attributeName);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getPersistentType().getName());
- }
-
-
- // ********** 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 Iterable<AttributeMapping> getAttributeMappings() {
- return new TransformationIterable<OrmReadOnlyPersistentAttribute, AttributeMapping>(this.getPersistentType().getAttributes()) {
- @Override
- protected AttributeMapping transform(OrmReadOnlyPersistentAttribute attribute) {
- return attribute.getMapping();
- }
- };
- }
-
- public Iterable<AttributeMapping> getAllAttributeMappings() {
- return new CompositeIterable<AttributeMapping>(this.getAllAttributeMappingsLists());
- }
-
- protected Iterable<Iterable<AttributeMapping>> getAllAttributeMappingsLists() {
- return new TransformationIterable<TypeMapping, Iterable<AttributeMapping>>(this.getInheritanceHierarchy(), TypeMappingTools.ATTRIBUTE_MAPPINGS_TRANSFORMER);
- }
-
- public Iterable<String> getOverridableAttributeNames() {
- return new CompositeIterable<String>(this.getOverridableAttributeNamesLists());
- }
-
- protected Iterable<Iterable<String>> getOverridableAttributeNamesLists() {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getAttributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
- }
-
- public Iterable<String> getAllOverridableAttributeNames() {
- return new CompositeIterable<String>(this.getAllOverridableAttributeNamesLists());
- }
-
- protected Iterable<Iterable<String>> getAllOverridableAttributeNamesLists() {
- return new TransformationIterable<TypeMapping, Iterable<String>>(this.getInheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER);
- }
-
- public Iterable<AttributeMapping> getAttributeMappings(final String mappingKey) {
- return new FilteringIterable<AttributeMapping>(CollectionTools.collection(this.getAttributeMappings())) {
- @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.getAllAttributeMappings())) {
- @Override
- protected boolean accept(AttributeMapping o) {
- return Tools.valuesAreEqual(o.getKey(), mappingKey);
- }
- };
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- for (AttributeMapping attributeMapping : this.getAttributeMappings()) {
- 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 Iterable<String> getOverridableAssociationNames() {
- return new CompositeIterable<String>(this.getOverridableAssociationNamesLists());
- }
-
- protected Iterable<Iterable<String>> getOverridableAssociationNamesLists() {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getAttributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
- }
-
- public Iterable<String> getAllOverridableAssociationNames() {
- return new CompositeIterable<String>(this.getAllOverridableAssociationNamesLists());
- }
-
- protected Iterable<Iterable<String>> getAllOverridableAssociationNamesLists() {
- return new TransformationIterable<TypeMapping, Iterable<String>>(this.getInheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER);
- }
-
- public Relationship resolveOverriddenRelationship(String attributeName) {
- for (AttributeMapping attributeMapping : this.getAttributeMappings()) {
- 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 Iterable<TypeMapping> getInheritanceHierarchy() {
- return this.convertToMappings(this.getPersistentType().getInheritanceHierarchy());
- }
-
- /**
- * 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 Iterable<TypeMapping> getAncestors() {
- return this.convertToMappings(this.getPersistentType().getAncestors());
- }
-
- protected Iterable<TypeMapping> convertToMappings(Iterable<PersistentType> types) {
- return new TransformationIterable<PersistentType, TypeMapping>(types) {
- @Override
- protected TypeMapping transform(PersistentType type) {
- return type.getMapping();
- }
- };
- }
-
-
- // ********** 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.getValidationTextRange(this.xmlTypeMapping.getClassTextRange());
- }
-
- public TextRange getAttributesTextRange() {
- return this.getValidationTextRange(this.xmlTypeMapping.getAttributesTextRange());
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange(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.getJavaResourceType(), this.buildTextRangeResolver());
- }
-
- protected TypeMappingTextRangeResolver buildTextRangeResolver() {
- return new OrmTypeMappingTextRangeResolver(this);
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getPersistenceUnit().validatesAgainstDatabase();
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlTypeMapping.getValidationTextRange();
- return (textRange != null) ? textRange : this.getPersistentType().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java
deleted file mode 100644
index d2c9d40b6b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java
+++ /dev/null
@@ -1,342 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> version mapping
- */
-public abstract class AbstractOrmVersionMapping<X extends XmlVersion>
- extends AbstractOrmAttributeMapping<X>
- implements OrmVersionMapping
-{
- protected final OrmColumn column;
-
- protected OrmConverter converter; // never null
-
-
- // the spec does not list Temporal explicitly,
- // but it is included in the orm.xml schema...
- protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
- OrmTemporalConverter.Adapter.instance(),
- };
- protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
-
-
- protected AbstractOrmVersionMapping(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.column = this.buildColumn();
- this.converter = this.buildConverter();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.column.synchronizeWithResourceModel();
- this.syncConverter();
- }
-
- @Override
- public void update() {
- super.update();
- this.column.update();
- this.converter.update();
- }
-
-
- // ********** column **********
-
- public OrmColumn getColumn() {
- return this.column;
- }
-
- protected OrmColumn buildColumn() {
- return this.getContextNodeFactory().buildOrmColumn(this, this);
- }
-
-
- // ********** converter **********
-
- public OrmConverter getConverter() {
- return this.converter;
- }
-
- public void setConverter(Class<? extends Converter> converterType) {
- if (this.converter.getType() != converterType) {
- // note: we may also clear the XML value we want;
- // but if we leave it, the resulting sync will screw things up...
- this.clearXmlConverterValues();
- OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType);
- this.setConverter_(this.buildConverter(converterAdapter));
- this.converter.initialize();
- }
- }
-
- protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) {
- return (converterAdapter != null) ?
- converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) :
- this.buildNullConverter();
- }
-
- protected void setConverter_(OrmConverter converter) {
- Converter old = this.converter;
- this.converter = converter;
- this.firePropertyChanged(CONVERTER_PROPERTY, old, converter);
- }
-
- protected void clearXmlConverterValues() {
- for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
- adapter.clearXmlValue(this.xmlAttributeMapping);
- }
- }
-
- protected OrmConverter buildConverter() {
- OrmXmlContextNodeFactory factory = this.getContextNodeFactory();
- for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
- OrmConverter ormConverter = adapter.buildConverter(this, factory);
- if (ormConverter != null) {
- return ormConverter;
- }
- }
- return this.buildNullConverter();
- }
-
- protected void syncConverter() {
- OrmConverter.Adapter adapter = this.getXmlConverterAdapter();
- if (adapter == null) {
- if (this.converter.getType() != null) {
- this.setConverter_(this.buildNullConverter());
- }
- } else {
- if (this.converter.getType() == adapter.getConverterType()) {
- this.converter.synchronizeWithResourceModel();
- } else {
- this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory()));
- }
- }
- }
-
- /**
- * Return the first adapter whose converter value is set in the XML mapping.
- * Return <code>null</code> if there are no converter values in the XML.
- */
- protected OrmConverter.Adapter getXmlConverterAdapter() {
- for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
- if (adapter.isActive(this.xmlAttributeMapping)) {
- return adapter;
- }
- }
- return null;
- }
-
- protected OrmConverter buildNullConverter() {
- return new NullOrmConverter(this);
- }
-
-
- // ********** converter adapters **********
-
- /**
- * Return the converter adapter for the specified converter type.
- */
- protected OrmConverter.Adapter getConverterAdapter(Class<? extends Converter> converterType) {
- for (OrmConverter.Adapter adapter : this.getConverterAdapters()) {
- if (adapter.getConverterType() == converterType) {
- return adapter;
- }
- }
- return null;
- }
-
- protected Iterable<OrmConverter.Adapter> getConverterAdapters() {
- return CONVERTER_ADAPTERS;
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 30;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmVersionMapping(this);
- }
-
- @Override
- protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) {
- super.initializeFromOrmColumnMapping(oldMapping);
- this.column.initializeFrom(oldMapping.getColumn());
- }
-
- public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
- xmlAttributes.getVersions().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
- xmlAttributes.getVersions().remove(this.xmlAttributeMapping);
- }
-
-
- // ********** OrmColumn.Owner implementation **********
-
- public String getDefaultColumnName() {
- return this.name;
- }
-
- public String getDefaultTableName() {
- return this.getTypeMapping().getPrimaryTableName();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- 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);
- this.validateAttributeType(messages);
- }
-
- protected void validateAttributeType(List<IMessage> messages) {
- if (!ArrayTools.contains(SUPPORTED_TYPE_NAMES, this.getPersistentAttribute().getTypeName())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE,
- new String[] {this.getName()},
- this,
- this.getNameTextRange()
- )
- );
- }
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java
deleted file mode 100644
index 85933e2db2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java
+++ /dev/null
@@ -1,263 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.VirtualBaseColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-
-public abstract class AbstractOrmVirtualBaseColumn<O extends OrmReadOnlyBaseColumn.Owner, C extends ReadOnlyBaseColumn>
- extends AbstractOrmVirtualNamedColumn<O, C>
- implements VirtualBaseColumn, OrmReadOnlyBaseColumn
-{
- 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(XmlContextNode 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;
- }
-
-
- // ********** misc **********
-
- public boolean tableNameIsInvalid() {
- return this.owner.tableNameIsInvalid(this.getTable());
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.owner.getCandidateTableNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getTableTextRange() {
- return this.getValidationTextRange();
- }
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver() {
- return new OrmBaseColumnTextRangeResolver(this);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
deleted file mode 100644
index bd15434ed1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java
+++ /dev/null
@@ -1,191 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.VirtualNamedColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> virtual<ul>
- * <li>column
- * <li>join column
- * <li>primary key 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 ReadOnlyNamedColumn>
- extends AbstractOrmXmlContextNode
- implements VirtualNamedColumn, OrmReadOnlyNamedColumn
-{
- protected final O owner;
-
- protected String specifiedName;
- protected String defaultName;
-
- protected String columnDefinition;
-
-
- protected AbstractOrmVirtualNamedColumn(XmlContextNode 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();
- }
-
-
- // ********** 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());
- }
-
- 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.getParent().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- /**
- * This is used by the subclasses that implement {@link ReadOnlyBaseJoinColumn#isVirtual()}.
- */
- public boolean isVirtual() {
- return true;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- String table = this.getTable();
- if (table != null) {
- sb.append(table);
- sb.append('.');
- }
- sb.append(this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
deleted file mode 100644
index 54bb896f70..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java
+++ /dev/null
@@ -1,210 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
-import org.eclipse.jpt.jpa.core.context.VirtualReferenceTable;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmVirtualReferenceTable<T extends ReadOnlyReferenceTable>
- extends AbstractOrmVirtualTable<T>
- implements VirtualReferenceTable
-{
- protected final ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> specifiedJoinColumnContainer;
- protected final OrmReadOnlyJoinColumn.Owner joinColumnOwner;
-
- protected OrmVirtualJoinColumn defaultJoinColumn;
-
-
- protected AbstractOrmVirtualReferenceTable(XmlContextNode parent, Owner owner, T overridenTable) {
- super(parent, owner, overridenTable);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedJoinColumns();
- this.updateDefaultJoinColumn();
- }
-
-
- // ********** join columns **********
-
- public ListIterable<OrmVirtualJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int getJoinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns() {
- return this.specifiedJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- return this.specifiedJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.getSpecifiedJoinColumnsSize() != 0;
- }
-
- public OrmVirtualJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumnContainer.getContextElement(index);
- }
-
- protected void updateSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.update();
- }
-
- protected ListIterable<ReadOnlyJoinColumn> getOverriddenJoinColumns() {
- return new SuperListIterableWrapper<ReadOnlyJoinColumn>(this.getOverriddenTable().getSpecifiedJoinColumns());
- }
-
- protected void moveSpecifiedJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
- this.specifiedJoinColumnContainer.moveContextElement(index, joinColumn);
- }
-
- protected OrmVirtualJoinColumn addSpecifiedJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- return this.specifiedJoinColumnContainer.addContextElement(index, joinColumn);
- }
-
- protected void removeSpecifiedJoinColumn(OrmVirtualJoinColumn joinColumn) {
- this.specifiedJoinColumnContainer.removeContextElement(joinColumn);
- }
-
- protected ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedJoinColumnContainer() {
- return new SpecifiedJoinColumnContainer();
- }
-
- /**
- * specified join column container
- */
- protected class SpecifiedJoinColumnContainer
- extends ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
- return AbstractOrmVirtualReferenceTable.this.buildJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
- return AbstractOrmVirtualReferenceTable.this.getOverriddenJoinColumns();
- }
- @Override
- protected ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
- return contextElement.getOverriddenColumn();
- }
- }
-
-
- // ********** 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(ReadOnlyJoinColumn joinColumn) {
- return this.buildJoinColumn(this.joinColumnOwner, joinColumn);
- }
-
- protected OrmVirtualJoinColumn buildJoinColumn(OrmReadOnlyJoinColumn.Owner columnOwner, ReadOnlyJoinColumn joinColumn) {
- return this.getContextNodeFactory().buildOrmVirtualJoinColumn(this, columnOwner, joinColumn);
- }
-
- protected abstract OrmReadOnlyJoinColumn.Owner buildJoinColumnOwner();
-
- @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.validateNodes(this.getJoinColumns(), messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java
deleted file mode 100644
index 6024883875..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java
+++ /dev/null
@@ -1,364 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.NameTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.VirtualTable;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractOrmVirtualTable<T extends ReadOnlyTable>
- extends AbstractOrmXmlContextNode
- implements VirtualTable, OrmReadOnlyTable
-{
- protected final Owner owner;
-
- protected final T overriddenTable;
-
- protected String specifiedName;
- protected String defaultName;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected final ContextListContainer<OrmVirtualUniqueConstraint, ReadOnlyUniqueConstraint> uniqueConstraintContainer;
-
-
- protected AbstractOrmVirtualTable(XmlContextNode parent, Owner owner, T overridenTable) {
- super(parent);
- this.owner = owner;
- this.overriddenTable = overridenTable;
- this.uniqueConstraintContainer = this.buildUniqueConstraintContainer();
- }
-
-
- // ********** 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 T getOverriddenTable() {
- return this.overriddenTable;
- }
-
-
- // ********** 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 ListIterable<OrmVirtualUniqueConstraint> getUniqueConstraints() {
- return this.uniqueConstraintContainer.getContextElements();
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraintContainer.getContextElementsSize();
- }
-
- public OrmVirtualUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraintContainer.getContextElement(index);
- }
-
- protected void updateUniqueConstraints() {
- this.uniqueConstraintContainer.update();
- }
-
- protected ListIterable<ReadOnlyUniqueConstraint> getOverriddenUniqueConstraints() {
- return new SuperListIterableWrapper<ReadOnlyUniqueConstraint>(this.getOverriddenTable().getUniqueConstraints());
- }
-
- protected void moveUniqueConstraint(int index, OrmVirtualUniqueConstraint constraint) {
- this.uniqueConstraintContainer.moveContextElement(index, constraint);
- }
-
- protected OrmVirtualUniqueConstraint addUniqueConstraint(int index, ReadOnlyUniqueConstraint uniqueConstraint) {
- return this.uniqueConstraintContainer.addContextElement(index, uniqueConstraint);
- }
-
- protected OrmVirtualUniqueConstraint buildUniqueConstraint(ReadOnlyUniqueConstraint uniqueConstraint) {
- return this.getContextNodeFactory().buildOrmVirtualUniqueConstraint(this, uniqueConstraint);
- }
-
- protected void removeUniqueConstraint(OrmVirtualUniqueConstraint constraint) {
- this.uniqueConstraintContainer.removeContextElement(constraint);
- }
-
- protected ContextListContainer<OrmVirtualUniqueConstraint, ReadOnlyUniqueConstraint> buildUniqueConstraintContainer() {
- return new UniqueConstraintContainer();
- }
-
- /**
- * unique constraint container
- */
- protected class UniqueConstraintContainer
- extends ContextListContainer<OrmVirtualUniqueConstraint, ReadOnlyUniqueConstraint>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return UNIQUE_CONSTRAINTS_LIST;
- }
- @Override
- protected OrmVirtualUniqueConstraint buildContextElement(ReadOnlyUniqueConstraint resourceElement) {
- return AbstractOrmVirtualTable.this.buildUniqueConstraint(resourceElement);
- }
- @Override
- protected ListIterable<ReadOnlyUniqueConstraint> getResourceElements() {
- return AbstractOrmVirtualTable.this.getOverriddenUniqueConstraints();
- }
- @Override
- protected ReadOnlyUniqueConstraint getResourceElement(OrmVirtualUniqueConstraint contextElement) {
- return contextElement.getOverriddenUniqueConstraint();
- }
- }
-
-
- // ********** database stuff **********
-
- public org.eclipse.jpt.jpa.db.Table getDbTable() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName());
- }
-
- public Schema getDbSchema() {
- SchemaContainer dbSchemaContainer = this.getDbSchemaContainer();
- return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema());
- }
-
- 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; 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);
- }
-
- /**
- * 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);
- }
-
- public 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 **********
-
- @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.getParent().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange();
- }
-
- public TextRange getSchemaTextRange() {
- return this.getValidationTextRange();
- }
-
- public TextRange getCatalogTextRange() {
- return this.getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.buildQualifiedName());
- }
-
- protected String buildQualifiedName() {
- return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java
deleted file mode 100644
index d6ec443ca7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java
+++ /dev/null
@@ -1,79 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
-import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.wst.common.project.facet.core.VersionFormatException;
-
-/**
- * Use this abstract class for context nodes that are part of an
- * <code>orm.xml</code> file.
- * This will not work for a pure {@link org.eclipse.jpt.jpa.core.context.MappingFile}
- * implementation.
- */
-public abstract class AbstractOrmXmlContextNode
- extends AbstractXmlContextNode
-{
- protected AbstractOrmXmlContextNode(JpaContextNode parent) {
- super(parent);
- }
-
-
- // ********** convenience methods **********
-
- @Override
- public EntityMappings getMappingFileRoot() {
- return (EntityMappings) super.getMappingFileRoot();
- }
-
- // TODO bjv need to cascade up containment hierarchy... (need public API:
- // JpaContextNode.getMappingFileDefinition() ?)
- protected OrmXmlDefinition getMappingFileDefinition() {
- OrmXml ormXml = this.getMappingFileRoot().getParent();
- if (ormXml instanceof GenericOrmXml) {
- return ((GenericOrmXml) ormXml).getMappingFileDefinition();
- }
- return (OrmXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.getResourceType());
- }
-
- protected EFactory getResourceNodeFactory() {
- return this.getMappingFileDefinition().getResourceNodeFactory();
- }
-
- // TODO bjv need to add API and delegate to orm.xml/entity mappings interface...
- protected boolean isOrmXml2_0Compatible() {
- String version = this.getMappingFileRoot().getVersion();
- try {
- return (version != null) && SimpleVersion.JPA_VERSION_COMPARATOR.compare(version, "2.0") >= 0; //$NON-NLS-1$
- } catch (VersionFormatException ex) {
- return false;
- }
- }
-
- /**
- * Call {@link #isOrmXml2_0Compatible()} before calling this method.
- */
- protected OrmXml2_0ContextNodeFactory getContextNodeFactory2_0() {
- return (OrmXml2_0ContextNodeFactory) this.getContextNodeFactory();
- }
-
- protected OrmXmlContextNodeFactory getContextNodeFactory() {
- return this.getMappingFileDefinition().getContextNodeFactory();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
deleted file mode 100644
index 7f2099dbe4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java
+++ /dev/null
@@ -1,392 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericEntityMappings;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmBasicMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEntity;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEnumeratedConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmGeneratedValue;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmGeneratorContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmIdMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmJoinTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmLobConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmManyToManyMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmManyToOneMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmMappedSuperclass;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNamedQuery;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNullAttributeMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOneToManyMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOneToOneMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOrderable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOverrideRelationship;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistenceUnitDefaults;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmQueryContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmQueryHint;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmSecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTableGenerator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTemporalConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTransientMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVersionMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualOverrideRelationship;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.UnsupportedOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
-
-public abstract class AbstractOrmXmlContextNodeFactory
- implements OrmXmlContextNodeFactory
-{
- public EntityMappings buildEntityMappings(OrmXml parent, XmlEntityMappings xmlEntityMappings) {
- return new GenericEntityMappings(parent, xmlEntityMappings);
- }
-
- public OrmPersistenceUnitMetadata buildOrmPersistenceUnitMetadata(EntityMappings parent) {
- return new GenericOrmPersistenceUnitMetadata(parent);
- }
-
- public OrmPersistenceUnitDefaults buildOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) {
- return new GenericOrmPersistenceUnitDefaults(parent);
- }
-
- public OrmPersistentType buildOrmPersistentType(EntityMappings parent, XmlTypeMapping resourceMapping) {
- return new GenericOrmPersistentType(parent, resourceMapping);
- }
-
- public OrmEntity buildOrmEntity(OrmPersistentType parent, XmlEntity resourceMapping) {
- return new GenericOrmEntity(parent, resourceMapping);
- }
-
- public OrmMappedSuperclass buildOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) {
- return new GenericOrmMappedSuperclass(parent, resourceMapping);
- }
-
- public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
- return new GenericOrmEmbeddable(parent, resourceMapping);
- }
-
- public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
- return new GenericOrmPersistentAttribute(parent, xmlMapping);
- }
-
- public OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentField(OrmPersistentType parent, JavaResourceField javaResourceField) {
- return new VirtualOrmPersistentAttribute(parent, javaResourceField);
- }
-
- public OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentProperty(OrmPersistentType parent, JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
- return new VirtualOrmPersistentAttribute(parent, javaResourceGetter, javaResourceSetter);
- }
-
- 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, ReadOnlyTable.Owner owner, JavaSecondaryTable javaSecondaryTable) {
- return new GenericOrmVirtualSecondaryTable(parent, owner, javaSecondaryTable);
- }
-
- public OrmPrimaryKeyJoinColumn buildOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmReadOnlyBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn resourcePrimaryKeyJoinColumn) {
- return new GenericOrmPrimaryKeyJoinColumn(parent, owner, resourcePrimaryKeyJoinColumn);
- }
-
- public OrmVirtualPrimaryKeyJoinColumn buildOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, OrmReadOnlyBaseJoinColumn.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, ReadOnlyTable.Owner owner, ReadOnlyJoinTable overriddenTable) {
- return new GenericOrmVirtualJoinTable(parent, owner, overriddenTable);
- }
-
- public OrmJoinColumn buildOrmJoinColumn(XmlContextNode parent, OrmReadOnlyJoinColumn.Owner owner, XmlJoinColumn xmlJoinColumn) {
- return new GenericOrmJoinColumn(parent, owner, xmlJoinColumn);
- }
-
- public OrmVirtualJoinColumn buildOrmVirtualJoinColumn(XmlContextNode parent, OrmReadOnlyJoinColumn.Owner owner, ReadOnlyJoinColumn overriddenColumn) {
- return new GenericOrmVirtualJoinColumn(parent, owner, overriddenColumn);
- }
-
- 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, ReadOnlyUniqueConstraint overriddenUniqueConstraint) {
- return new GenericOrmVirtualUniqueConstraint(parent, overriddenUniqueConstraint);
- }
-
- public OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent) {
- return new GenericOrmEnumeratedConverter(parent);
- }
-
- public OrmConverter buildOrmLobConverter(OrmAttributeMapping parent) {
- return new GenericOrmLobConverter(parent);
- }
-
- public OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent) {
- return new GenericOrmTemporalConverter(parent);
- }
-
- public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) {
- return new GenericOrmOrderable(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java
deleted file mode 100644
index 97b9f47aac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import java.util.ArrayList;
-
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.UnsupportedOrmAttributeMappingDefinition;
-
-/**
- * All the state in the definition should be "static"
- * (i.e. unchanging once it is initialized).
- */
-public abstract class AbstractOrmXmlDefinition
- implements OrmXmlDefinition
-{
- protected final OrmXmlContextNodeFactory factory;
-
- protected ArrayList<OrmTypeMappingDefinition> typeMappingDefinitions;
-
- protected ArrayList<OrmAttributeMappingDefinition> attributeMappingDefinitions;
-
-
- /**
- * zero-argument constructor
- */
- protected AbstractOrmXmlDefinition() {
- super();
- this.factory = this.buildContextNodeFactory();
- }
-
-
- // ********** factory **********
-
- protected abstract OrmXmlContextNodeFactory buildContextNodeFactory();
-
- public OrmXmlContextNodeFactory getContextNodeFactory() {
- return this.factory;
- }
-
-
- // ********** type mapping definitions **********
-
- public OrmTypeMappingDefinition getTypeMappingDefinition(String mappingKey) {
- for (OrmTypeMappingDefinition definition : this.getTypeMappingDefinitions()) {
- if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
- return definition;
- }
- }
- throw new IllegalArgumentException("Illegal type mapping key: " + mappingKey); //$NON-NLS-1$
- }
-
- /**
- * Return a list of mapping definitions to use for types in
- * <code>orm.xml</code> mapping files.
- * The order is unimportant.
- */
- protected synchronized ArrayList<OrmTypeMappingDefinition> getTypeMappingDefinitions() {
- if (this.typeMappingDefinitions == null) {
- this.typeMappingDefinitions = this.buildTypeMappingDefinitions();
- }
- return this.typeMappingDefinitions;
- }
-
- protected ArrayList<OrmTypeMappingDefinition> buildTypeMappingDefinitions() {
- ArrayList<OrmTypeMappingDefinition> definitions = new ArrayList<OrmTypeMappingDefinition>();
- this.addTypeMappingDefinitionsTo(definitions);
- return definitions;
- }
-
- protected abstract void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions);
-
-
- // ********** attribute mapping definitions **********
-
- public OrmAttributeMappingDefinition getAttributeMappingDefinition(String mappingKey) {
- for (OrmAttributeMappingDefinition definition : this.getAttributeMappingDefinitions()) {
- if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) {
- return definition;
- }
- }
- return UnsupportedOrmAttributeMappingDefinition.instance();
- }
-
- /**
- * Return a list of mapping definitions to use for attributes in
- * <code>orm.xml</code> mapping files.
- * The order is unimportant.
- */
- protected synchronized ArrayList<OrmAttributeMappingDefinition> getAttributeMappingDefinitions() {
- if (this.attributeMappingDefinitions == null) {
- this.attributeMappingDefinitions = this.buildAttributeMappingDefinitions();
- }
- return this.attributeMappingDefinitions;
- }
-
- protected ArrayList<OrmAttributeMappingDefinition> buildAttributeMappingDefinitions() {
- ArrayList<OrmAttributeMappingDefinition> definitions = new ArrayList<OrmAttributeMappingDefinition>();
- this.addAttributeMappingDefinitionsTo(definitions);
- return definitions;
- }
-
- protected abstract void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
deleted file mode 100644
index e0e6b9c98b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
+++ /dev/null
@@ -1,380 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.internal.utility.JDTTools;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> ID class reference
- */
-public class GenericOrmIdClassReference
- extends AbstractXmlContextNode
- implements OrmIdClassReference
-{
- protected final Owner owner;
-
- protected String specifiedIdClassName;
- protected String defaultIdClassName;
- protected JavaPersistentType idClass;
-
-
- public GenericOrmIdClassReference(OrmTypeMapping parent, Owner owner) {
- super(parent);
- this.owner = owner;
- this.specifiedIdClassName = this.buildSpecifiedIdClassName();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedIdClassName_(this.buildSpecifiedIdClassName());
- // sync the id class *after* we have the specified name
- this.syncIdClass();
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultIdClassName(this.buildDefaultIdClassName());
- this.updateIdClass();
- }
-
-
- // ********** id class name **********
-
- public String getIdClassName() {
- return (this.specifiedIdClassName != null) ? this.specifiedIdClassName : this.defaultIdClassName;
- }
-
- public String getSpecifiedIdClassName() {
- return this.specifiedIdClassName;
- }
-
- public void setSpecifiedIdClassName(String name) {
- if (this.valuesAreDifferent(this.specifiedIdClassName, name)) {
- XmlClassReference xmlClassRef = this.getXmlIdClassRefForUpdate();
- this.setSpecifiedIdClassName_(name);
- xmlClassRef.setClassName(name);
- this.removeXmlIdClassRefIfUnset();
- }
- }
-
- /**
- * We clear out {@link #idClass} here because we cannot compare its name
- * to the specified name, since it may have been prefixed by the entity
- * mappings package.
- */
- protected void setSpecifiedIdClassName_(String name) {
- String old = this.specifiedIdClassName;
- this.specifiedIdClassName = name;
- if (this.firePropertyChanged(SPECIFIED_ID_CLASS_NAME_PROPERTY, old, name)) {
- // clear out the Java type here, it will be rebuilt during "update"
- if (this.idClass != null) {
- this.idClass.dispose();
- this.setIdClass(null);
- }
- }
- }
-
- protected String buildSpecifiedIdClassName() {
- XmlClassReference xmlIdClassRef = this.getXmlIdClassRef();
- return (xmlIdClassRef == null) ? null : xmlIdClassRef.getClassName();
- }
-
- public String getDefaultIdClassName() {
- return this.defaultIdClassName;
- }
-
- protected void setDefaultIdClassName(String name) {
- String old = this.defaultIdClassName;
- this.defaultIdClassName = name;
- this.firePropertyChanged(DEFAULT_ID_CLASS_NAME_PROPERTY, old, name);
- }
-
- protected String buildDefaultIdClassName() {
- JavaIdClassReference javaRef = this.owner.getJavaIdClassReferenceForDefaults();
- return (javaRef == null) ? null : javaRef.getFullyQualifiedIdClassName();
- }
-
- public boolean isSpecified() {
- return this.getIdClassName() != null;
- }
-
-
- // ********** xml id class ref **********
-
- /**
- * Return null if the XML class ref does not exists.
- */
- protected XmlClassReference getXmlIdClassRef() {
- return this.getXmlIdClassContainer().getIdClass();
- }
-
- /**
- * Build the XML class ref if it does not exist.
- */
- protected XmlClassReference getXmlIdClassRefForUpdate() {
- XmlClassReference xmlClassRef = this.getXmlIdClassRef();
- return (xmlClassRef != null) ? xmlClassRef : this.buildXmlIdClassRef();
- }
-
- protected XmlClassReference buildXmlIdClassRef() {
- XmlClassReference ref = OrmFactory.eINSTANCE.createXmlClassReference();
- this.getXmlIdClassContainer().setIdClass(ref);
- return ref;
- }
-
- protected void removeXmlIdClassRefIfUnset() {
- if (this.getXmlIdClassRef().isUnset()) {
- this.removeXmlIdClassRef();
- }
- }
-
- protected void removeXmlIdClassRef() {
- this.getXmlIdClassContainer().setIdClass(null);
- }
-
-
- // ********** id class **********
-
- public JavaPersistentType getIdClass() {
- return this.idClass;
- }
-
- protected void setIdClass(JavaPersistentType idClass) {
- JavaPersistentType old = this.idClass;
- this.idClass = idClass;
- this.firePropertyChanged(ID_CLASS_PROPERTY, old, idClass);
- }
-
- /**
- * If the specified ID class name changes during
- * <em>sync</em>, the ID class will be cleared out in
- * {@link #setSpecifiedIdClassName_(String)}. If we get here and
- * the ID class is still present, we can
- * <code>sync</code> it. Of course, it might be still obsolete if the
- * entity mappings's package has changed....
- *
- * @see #updateIdClass()
- */
- protected void syncIdClass() {
- if (this.idClass != null) {
- this.idClass.synchronizeWithResourceModel();
- }
- }
-
- /**
- * @see #syncIdClass()
- */
- protected void updateIdClass() {
- JavaResourceType 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.getJavaResourceType() == 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 JavaResourceType resolveJavaResourceIdClass() {
- String idClassName = this.getIdClassName();
- if (idClassName == null) {
- return null;
- }
- JavaResourceAbstractType jrat = this.getEntityMappings().resolveJavaResourceType(idClassName);
- if (jrat == null || jrat.getKind() != Kind.TYPE) {
- return null;
- }
- JavaResourceType jrt = (JavaResourceType) jrat;
- return jrt.isAnnotatedWith(getJpaProject().getTypeMappingAnnotations()) ? null : jrt;
- }
-
- protected JavaPersistentType buildIdClass(JavaResourceType 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
- this.validateIdClass(messages, reporter);
- }
-
- protected void validateIdClass(List<IMessage> messages, IReporter reporter) {
- IJavaProject javaProject = getJpaProject().getJavaProject();
- if (this.isSpecified()) {
- JavaResourceType jrt = (JavaResourceType) getJpaProject().getJavaResourceType(this.getIdClassName(), Kind.TYPE);
- if ((jrt != null) && (jrt.isAnnotatedWith(getJpaProject().getTypeMappingAnnotations()))) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_ID_CLASS_NOT_VALID,
- new String[] {jrt.getName()},
- this,
- this.getValidationTextRange()
- )
- );
- } else if (StringTools.stringIsEmpty(this.getIdClassName())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_ID_CLASS_NAME_EMPTY,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange()
- )
- );
- } else if (JDTTools.findType(javaProject, this.getIdClassName()) == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_ID_CLASS_NOT_EXIST,
- new String[] { this.getIdClassName()},
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlValidationTextRange();
- return (textRange != null) ? textRange : this.getTypeMapping().getValidationTextRange();
- }
-
- protected TextRange getXmlValidationTextRange() {
- XmlClassReference xmlIdClassRef = this.getXmlIdClassRef();
- return (xmlIdClassRef == null) ? null : xmlIdClassRef.getClassNameTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java
deleted file mode 100644
index 7ada92b093..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java
+++ /dev/null
@@ -1,174 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingMappedByRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmManyToManyRelationship
- extends AbstractOrmMappingRelationship<OrmManyToManyMapping>
- implements OrmManyToManyRelationship
-{
- protected final OrmMappingMappedByRelationshipStrategy2_0 mappedByStrategy;
-
- protected final OrmMappingJoinTableRelationshipStrategy2_0 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 OrmMappingRelationshipStrategy2_0 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 OrmMappingMappedByRelationshipStrategy2_0 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 OrmMappingJoinTableRelationshipStrategy2_0 buildJoinTableStrategy() {
- return new GenericOrmMappingJoinTableRelationshipStrategy(this);
- }
-
-
- // ********** conversions **********
-
- public void initializeOn(Relationship newRelationship) {
- newRelationship.initializeFromMappedByRelationship(this);
- newRelationship.initializeFromJoinTableRelationship(this);
- }
-
- @Override
- public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
- super.initializeFromMappedByRelationship(oldRelationship);
- this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
- }
-
- @Override
- public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
- super.initializeFromJoinTableRelationship(oldRelationship);
- this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
- }
-
-
- // ********** misc **********
-
- @Override
- protected XmlManyToMany getXmlMapping() {
- return (XmlManyToMany) super.getXmlMapping();
- }
-
- public XmlManyToMany getXmlContainer() {
- return this.getXmlMapping();
- }
-
- public boolean isOwner() {
- return this.mappedByStrategy.getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.mappedByStrategy.validate(messages, reporter);
- this.joinTableStrategy.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java
deleted file mode 100644
index 5379388ee0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java
+++ /dev/null
@@ -1,179 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmManyToOneRelationship
- extends AbstractOrmMappingRelationship<OrmManyToOneMapping>
- implements OrmManyToOneRelationship2_0
-{
- protected final OrmMappingJoinColumnRelationshipStrategy2_0 joinColumnStrategy;
-
- // JPA 2.0
- protected final OrmMappingJoinTableRelationshipStrategy2_0 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 OrmMappingRelationshipStrategy2_0 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 OrmMappingJoinTableRelationshipStrategy2_0 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 OrmMappingJoinColumnRelationshipStrategy2_0 buildJoinColumnStrategy() {
- return new GenericOrmMappingJoinColumnRelationshipStrategy(this);
- }
-
-
- // ********** conversions **********
-
- public void initializeOn(Relationship newRelationship) {
- newRelationship.initializeFromJoinColumnRelationship(this);
- newRelationship.initializeFromJoinTableRelationship(this);
- }
-
- @Override
- public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
- super.initializeFromJoinTableRelationship(oldRelationship);
- this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
- }
-
- @Override
- public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
- super.initializeFromJoinColumnRelationship(oldRelationship);
- this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
- }
-
-
- // ********** misc **********
-
- @Override
- protected XmlManyToOne getXmlMapping() {
- return (XmlManyToOne) super.getXmlMapping();
- }
-
- public XmlManyToOne getXmlContainer() {
- return this.getXmlMapping();
- }
-
- public boolean isOwner() {
- return true;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return false;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.joinColumnStrategy.validate(messages, reporter);
- this.joinTableStrategy.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java
deleted file mode 100644
index 77a8eb8aa0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java
+++ /dev/null
@@ -1,225 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationship;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingMappedByRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmMappedByRelationshipStrategy
- extends AbstractOrmXmlContextNode
- implements OrmMappingMappedByRelationshipStrategy2_0
-{
- 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 ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return null; // mapped-by strategies cannot be overridden
- }
-
- public void addStrategy() {
- if (this.mappedByAttribute == null) {
- this.setMappedByAttribute(""); //$NON-NLS-1$
- }
- }
-
- public void removeStrategy() {
- if (this.mappedByAttribute != null) {
- this.setMappedByAttribute(null);
- }
- }
-
- public Iterable<String> getCandidateMappedByAttributeNames() {
- return this.getRelationshipMapping().getAllTargetEntityAttributeNames();
- }
-
-
- // ********** validation **********
-
- @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 = NLS.bind(JpaValidationDescriptionMessages.ATTRIBUTE_DESC, 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.getXmlMappedByMapping().getMappedByTextRange();
- return (textRange != null) ? textRange : this.getRelationship().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 2cbba2264a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,170 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.db.Table;
-
-public class GenericOrmMappingJoinColumnRelationshipStrategy
- extends AbstractOrmJoinColumnRelationshipStrategy
- implements OrmMappingJoinColumnRelationshipStrategy2_0
-{
- 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 OrmReadOnlyJoinColumn.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;
- }
-
- public ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return overrideRelationship.getJoinColumnStrategy();
- }
-
-
- // ********** 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 OrmReadOnlyJoinColumn.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 Iterable<String> getCandidateTableNames() {
- return GenericOrmMappingJoinColumnRelationshipStrategy.this.getCandidateTableNames();
- }
-
- 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 getJoinColumnsSize() {
- return GenericOrmMappingJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmMappingJoinColumnRelationshipStrategy.this.getValidationTextRange();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new JoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java
deleted file mode 100644
index 38e575d0c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,72 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.InverseJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableValidator;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinTableRelationshipStrategy2_0;
-
-public class GenericOrmMappingJoinTableRelationshipStrategy
- extends AbstractOrmJoinTableRelationshipStrategy
- implements OrmMappingJoinTableRelationshipStrategy2_0
-{
- public GenericOrmMappingJoinTableRelationshipStrategy(OrmMappingJoinTableRelationship parent) {
- super(parent);
- }
-
-
- public boolean isOverridable() {
- return this.getJpaPlatformVariation().isJoinTableOverridable();
- }
-
- public ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return overrideRelationship.getJoinTableStrategy();
- }
-
-
- // ********** validation **********
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationshipMapping().validatesAgainstDatabase();
- }
-
- public TextRange getValidationTextRange() {
- return this.getRelationship().getValidationTextRange();
- }
-
- protected PersistentAttribute getPersistentAttribute() {
- return getRelationshipMapping().getPersistentAttribute();
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new JoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new InverseJoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return new JoinTableValidator(this.getPersistentAttribute(), (ReadOnlyJoinTable) table, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java
deleted file mode 100644
index 6331704dc9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java
+++ /dev/null
@@ -1,244 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingMappedByRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyRelationship2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmOneToManyRelationship
- extends AbstractOrmMappingRelationship<OrmOneToManyMapping>
- implements OrmOneToManyRelationship2_0
-{
- protected final OrmMappingMappedByRelationshipStrategy2_0 mappedByStrategy;
-
- protected final OrmMappingJoinTableRelationshipStrategy2_0 joinTableStrategy;
-
- // JPA 2.0 or EclipseLink
- protected final boolean supportsJoinColumnStrategy;
- protected final OrmMappingJoinColumnRelationshipStrategy2_0 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 OrmMappingRelationshipStrategy2_0 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 OrmMappingMappedByRelationshipStrategy2_0 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 OrmMappingJoinTableRelationshipStrategy2_0 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 OrmMappingJoinColumnRelationshipStrategy2_0 buildJoinColumnStrategy() {
- return this.supportsJoinColumnStrategy ?
- new GenericOrmMappingJoinColumnRelationshipStrategy(this, true) : // true = target foreign key
- new NullOrmJoinColumnRelationshipStrategy(this);
- }
-
-
- // ********** conversions **********
-
- public void initializeOn(Relationship newRelationship) {
- newRelationship.initializeFromMappedByRelationship(this);
- newRelationship.initializeFromJoinTableRelationship(this);
- newRelationship.initializeFromJoinColumnRelationship(this);
- }
-
- @Override
- public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
- super.initializeFromMappedByRelationship(oldRelationship);
- this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
- }
-
- @Override
- public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
- super.initializeFromJoinTableRelationship(oldRelationship);
- this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
- }
-
- @Override
- public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
- super.initializeFromJoinColumnRelationship(oldRelationship);
- this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
- }
-
-
- // ********** misc **********
-
- @Override
- protected XmlOneToMany getXmlMapping() {
- return (XmlOneToMany) super.getXmlMapping();
- }
-
- public XmlOneToMany getXmlContainer() {
- return this.getXmlMapping();
- }
-
- public boolean isOwner() {
- return this.mappedByStrategy.getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
- }
-
- @Override
- public boolean isTargetForeignKey() {
- return this.joinColumnStrategy.isTargetForeignKey();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.mappedByStrategy.validate(messages, reporter);
- this.joinTableStrategy.validate(messages, reporter);
- this.joinColumnStrategy.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
deleted file mode 100644
index d01a46ca29..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java
+++ /dev/null
@@ -1,267 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingMappedByRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingPrimaryKeyJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneRelationship2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmOneToOneRelationship
- extends AbstractOrmMappingRelationship<OrmOneToOneMapping>
- implements OrmOneToOneRelationship2_0
-{
- protected final OrmMappingMappedByRelationshipStrategy2_0 mappedByStrategy;
-
- protected final OrmMappingPrimaryKeyJoinColumnRelationshipStrategy2_0 primaryKeyJoinColumnStrategy;
-
- // JPA 2.0
- protected final OrmMappingJoinTableRelationshipStrategy2_0 joinTableStrategy;
-
- protected final OrmMappingJoinColumnRelationshipStrategy2_0 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 OrmMappingRelationshipStrategy2_0 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 OrmMappingMappedByRelationshipStrategy2_0 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 OrmMappingPrimaryKeyJoinColumnRelationshipStrategy2_0 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 OrmMappingJoinTableRelationshipStrategy2_0 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.getPrimaryKeyJoinColumnsSize() == 0) &&
- (this.joinTableStrategy.getJoinTable() == null);
- }
-
- protected OrmMappingJoinColumnRelationshipStrategy2_0 buildJoinColumnStrategy() {
- return new GenericOrmMappingJoinColumnRelationshipStrategy(this);
- }
-
-
- // ********** conversions **********
-
- public void initializeOn(Relationship newRelationship) {
- newRelationship.initializeFromMappedByRelationship(this);
- newRelationship.initializeFromJoinTableRelationship(this);
- newRelationship.initializeFromJoinColumnRelationship(this);
- // no other pk join column relationships yet
- }
-
- @Override
- public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) {
- super.initializeFromMappedByRelationship(oldRelationship);
- this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy());
- }
-
- @Override
- public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) {
- super.initializeFromJoinTableRelationship(oldRelationship);
- this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy());
- }
-
- @Override
- public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) {
- super.initializeFromJoinColumnRelationship(oldRelationship);
- this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy());
- }
-
-
- // ********** misc **********
-
- @Override
- protected XmlOneToOne getXmlMapping() {
- return (XmlOneToOne) super.getXmlMapping();
- }
-
- public XmlOneToOne getXmlContainer() {
- return this.getXmlMapping();
- }
-
- public boolean isOwner() {
- return this.mappedByStrategy.getMappedByAttribute() == null;
- }
-
- public boolean isOwnedBy(RelationshipMapping mapping) {
- return this.mappedByStrategy.relationshipIsOwnedBy(mapping);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.mappedByStrategy.validate(messages, reporter);
- this.primaryKeyJoinColumnStrategy.validate(messages, reporter);
- this.joinTableStrategy.validate(messages, reporter);
- this.joinColumnStrategy.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
deleted file mode 100644
index c08686c22b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,189 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Table;
-
-public class GenericOrmOverrideJoinColumnRelationshipStrategy
- extends AbstractOrmJoinColumnRelationshipStrategy
-{
- public GenericOrmOverrideJoinColumnRelationshipStrategy(OrmOverrideRelationship parent) {
- super(parent);
- }
-
- @Override
- protected OrmReadOnlyJoinColumn.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.getRelationship().getTypeMapping();
- }
-
- public TypeMapping getRelationshipTarget() {
- return this.isTargetForeignKey() ?
- this.getRelationship().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.getRelationship().getMapping();
- }
-
- protected String getAttributeName() {
- return this.getRelationship().getAttributeName();
- }
-
- @Override
- public String getTableName() {
- return this.isTargetForeignKey() ?
- super.getTableName() :
- this.getRelationship().getDefaultTableName();
- }
-
- @Override
- public Table resolveDbTable(String tableName) {
- return this.isTargetForeignKey() ?
- super.resolveDbTable(tableName) :
- this.getRelationship().resolveDbTable(tableName);
- }
-
- @Override
- public boolean tableNameIsInvalid(String tableName) {
- return this.isTargetForeignKey() ?
- super.tableNameIsInvalid(tableName) :
- this.getRelationship().tableNameIsInvalid(tableName);
- }
-
- @Override
- public Iterable<String> getCandidateTableNames() {
- return this.isTargetForeignKey() ?
- super.getCandidateTableNames() :
- this.getRelationship().getCandidateTableNames();
- }
-
- public String getColumnTableNotValidDescription() {
- return null;
- }
-
- public boolean isOverridable() {
- return false;
- }
-
- @Override
- public OrmOverrideRelationship getRelationship() {
- return (OrmOverrideRelationship) super.getRelationship();
- }
-
- public TextRange getValidationTextRange() {
- return this.getRelationship().getValidationTextRange();
- }
-
-
- // ********** join column owner **********
-
- protected class JoinColumnOwner
- implements OrmReadOnlyJoinColumn.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 Iterable<String> getCandidateTableNames() {
- return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getCandidateTableNames();
- }
-
- 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 getJoinColumnsSize() {
- return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getValidationTextRange();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getRelationship().buildColumnValidator((ReadOnlyBaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
deleted file mode 100644
index bcbe5ac2d1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,309 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingPrimaryKeyJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmPrimaryKeyJoinColumnRelationshipStrategy
- extends AbstractOrmXmlContextNode
- implements OrmMappingPrimaryKeyJoinColumnRelationshipStrategy2_0
-{
- protected final PrimaryKeyJoinColumnContainer primaryKeyJoinColumnContainer;
- protected final OrmReadOnlyJoinColumn.Owner primaryKeyJoinColumnOwner;
-
-
- public GenericOrmPrimaryKeyJoinColumnRelationshipStrategy(OrmPrimaryKeyJoinColumnRelationship parent) {
- super(parent);
- this.primaryKeyJoinColumnContainer = new PrimaryKeyJoinColumnContainer();
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- }
-
-
- // ********** 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 ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.primaryKeyJoinColumnContainer.getContextElements();
- }
-
- public int getPrimaryKeyJoinColumnsSize() {
- return this.primaryKeyJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasPrimaryKeyJoinColumns() {
- return this.getPrimaryKeyJoinColumnsSize() != 0;
- }
-
- public OrmPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) {
- return this.primaryKeyJoinColumnContainer.getContextElement(index);
- }
-
- public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn() {
- return this.addPrimaryKeyJoinColumn(this.getPrimaryKeyJoinColumnsSize());
- }
-
- public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) {
- XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn joinColumn = this.primaryKeyJoinColumnContainer.addContextElement(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.primaryKeyJoinColumnContainer.indexOfContextElement((OrmPrimaryKeyJoinColumn) joinColumn));
- }
-
- public void removePrimaryKeyJoinColumn(int index) {
- this.primaryKeyJoinColumnContainer.removeContextElement(index);
- this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().remove(index);
- }
-
- public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.primaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
- }
-
-
- protected void syncPrimaryKeyJoinColumns() {
- this.primaryKeyJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlPrimaryKeyJoinColumn>(this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns());
- }
-
- /**
- * primary key join column container
- */
- protected class PrimaryKeyJoinColumnContainer
- extends ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return PRIMARY_KEY_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmPrimaryKeyJoinColumn buildContextElement(XmlPrimaryKeyJoinColumn resourceElement) {
- return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.buildPrimaryKeyJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
- return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getXmlPrimaryKeyJoinColumns();
- }
- @Override
- protected XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- }
-
- protected OrmReadOnlyJoinColumn.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 ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return null; // pk join column strategies cannot be overridden
- }
-
- public void addStrategy() {
- if (this.getPrimaryKeyJoinColumnsSize() == 0) {
- this.addPrimaryKeyJoinColumn();
- }
- }
-
- public void removeStrategy() {
- for (int i = this.getPrimaryKeyJoinColumnsSize(); 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 OrmReadOnlyJoinColumn.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();
- }
-
- protected PersistentAttribute getPersistentAttribute() {
- return this.getRelationshipMapping().getPersistentAttribute();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- 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 getJoinColumnsSize() {
- return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumnsSize();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getValidationTextRange();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new OneToOnePrimaryKeyJoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
- }
-
- protected RelationshipMapping getRelationshipMapping() {
- return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getRelationshipMapping();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java
deleted file mode 100644
index ca3dfd563b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java
+++ /dev/null
@@ -1,396 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> virtual join table
- */
-public class GenericOrmVirtualJoinTable
- extends AbstractOrmVirtualReferenceTable<ReadOnlyJoinTable>
- implements OrmVirtualJoinTable
-{
-
- protected final ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> specifiedInverseJoinColumnContainer;
- protected final OrmReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
-
- protected OrmVirtualJoinColumn defaultInverseJoinColumn;
-
-
- public GenericOrmVirtualJoinTable(OrmVirtualJoinTableRelationshipStrategy parent, Owner owner, ReadOnlyJoinTable overriddenTable) {
- super(parent, owner, overriddenTable);
- this.specifiedInverseJoinColumnContainer = this.buildSpecifiedInverseJoinColumnContainer();
- this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedInverseJoinColumns();
- this.updateDefaultInverseJoinColumn();
- }
-
-
- // ********** inverse join columns **********
-
- public ListIterable<OrmVirtualJoinColumn> getInverseJoinColumns() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
- }
-
- public int getInverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
- }
-
-
- // ********** specified inverse join columns **********
-
- public ListIterable<OrmVirtualJoinColumn> getSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumnsSize() != 0;
- }
-
- public OrmVirtualJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumnContainer.getContextElement(index);
- }
-
- protected void updateSpecifiedInverseJoinColumns() {
- this.specifiedInverseJoinColumnContainer.update();
- }
-
- protected ListIterable<ReadOnlyJoinColumn> getOverriddenInverseJoinColumns() {
- return new SuperListIterableWrapper<ReadOnlyJoinColumn>(this.getOverriddenTable().getSpecifiedInverseJoinColumns());
- }
-
- protected void moveSpecifiedInverseJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
- this.specifiedInverseJoinColumnContainer.moveContextElement(index, joinColumn);
- }
-
- protected OrmVirtualJoinColumn addSpecifiedInverseJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- return this.specifiedInverseJoinColumnContainer.addContextElement(index, joinColumn);
- }
-
- protected void removeSpecifiedInverseJoinColumn(OrmVirtualJoinColumn joinColumn) {
- this.specifiedInverseJoinColumnContainer.removeContextElement(joinColumn);
- }
-
- protected ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedInverseJoinColumnContainer() {
- return new SpecifiedInverseJoinColumnContainer();
- }
-
- /**
- * specified inverse join column container
- */
- protected class SpecifiedInverseJoinColumnContainer
- extends ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_INVERSE_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
- return GenericOrmVirtualJoinTable.this.buildInverseJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
- return GenericOrmVirtualJoinTable.this.getOverriddenInverseJoinColumns();
- }
- @Override
- protected ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
- return contextElement.getOverriddenColumn();
- }
- }
-
-
- // ********** 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 getRelationshipStrategy() {
- return this.getParent();
- }
-
- @Override
- protected OrmReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
- protected OrmReadOnlyJoinColumn.Owner buildInverseJoinColumnOwner() {
- return new InverseJoinColumnOwner();
- }
-
- protected OrmVirtualJoinColumn buildInverseJoinColumn(ReadOnlyJoinColumn joinColumn) {
- return this.buildJoinColumn(this.inverseJoinColumnOwner, joinColumn);
- }
-
- @Override
- protected String buildDefaultName() {
- return this.getRelationshipStrategy().getJoinTableDefaultName();
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getRelationshipStrategy().getRelationship().getMapping();
- }
-
- public PersistentAttribute getPersistentAttribute() {
- return this.getRelationshipMapping().getPersistentAttribute();
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateJoinColumns(List<IMessage> messages, IReporter reporter) {
- super.validateJoinColumns(messages, reporter);
- this.validateNodes(this.getInverseJoinColumns(), messages, reporter);
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationshipStrategy().validatesAgainstDatabase();
- }
-
-
- // ********** join column owners **********
-
- /**
- * just a little common behavior
- */
- protected abstract class AbstractJoinColumnOwner
- implements OrmReadOnlyJoinColumn.Owner
- {
- protected AbstractJoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getRelationship().getTypeMapping();
- }
-
- /**
- * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
- */
- public String getDefaultColumnName() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * If there is a specified table name it needs to be the same
- * the default table name. The table is always the join table.
- */
- public boolean tableNameIsInvalid(String tableName) {
- return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
- }
-
- /**
- * the join column can only be on the join table itself
- */
- public Iterable<String> getCandidateTableNames() {
- return EmptyIterable.instance();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return Tools.valuesAreEqual(GenericOrmVirtualJoinTable.this.getName(), tableName) ?
- GenericOrmVirtualJoinTable.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 GenericOrmVirtualJoinTable.this.getName();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmVirtualJoinTable.this.getValidationTextRange();
- }
-
- protected OrmVirtualRelationship getRelationship() {
- return this.getRelationshipStrategy().getRelationship();
- }
-
- protected OrmVirtualJoinTableRelationshipStrategy getRelationshipStrategy() {
- return GenericOrmVirtualJoinTable.this.getRelationshipStrategy();
- }
- }
-
-
- /**
- * 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());
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName);
- return (dbTable != null) ? dbTable : this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmVirtualJoinTable.this.defaultJoinColumn == joinColumn;
- }
-
- public int getJoinColumnsSize() {
- return GenericOrmVirtualJoinTable.this.getJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getRelationshipStrategy().buildJoinTableJoinColumnValidator((ReadOnlyJoinColumn) 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 = GenericOrmVirtualJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- RelationshipMapping relationshipMapping = GenericOrmVirtualJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getName();
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName);
- if (dbTable != null) {
- return dbTable;
- }
- Entity relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.resolveDbTable(tableName);
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- Entity relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmVirtualJoinTable.this.defaultInverseJoinColumn == joinColumn;
- }
-
- public int getJoinColumnsSize() {
- return GenericOrmVirtualJoinTable.this.getInverseJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getRelationshipStrategy().buildJoinTableInverseJoinColumnValidator((ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 95a79ea5dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,389 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmVirtualOverrideJoinColumnRelationshipStrategy
- extends AbstractOrmXmlContextNode
- implements OrmVirtualJoinColumnRelationshipStrategy
-{
- protected final ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> specifiedJoinColumnContainer;
- protected final OrmReadOnlyJoinColumn.Owner joinColumnOwner;
-
- protected OrmVirtualJoinColumn defaultJoinColumn;
-
-
- public GenericOrmVirtualOverrideJoinColumnRelationshipStrategy(OrmVirtualOverrideRelationship parent) {
- super(parent);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedJoinColumns();
- this.updateDefaultJoinColumn();
- }
-
-
- // ********** join columns **********
-
- public ListIterable<OrmVirtualJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int getJoinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<OrmVirtualJoinColumn> getSpecifiedJoinColumns() {
- return this.specifiedJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- return this.specifiedJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.getSpecifiedJoinColumnsSize() != 0;
- }
-
- public OrmVirtualJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumnContainer.getContextElement(index);
- }
-
- protected void updateSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.update();
- }
-
- protected ListIterable<ReadOnlyJoinColumn> getOverriddenSpecifiedJoinColumns() {
- ReadOnlyJoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
- return (overriddenStrategy == null) ?
- EmptyListIterable.<ReadOnlyJoinColumn>instance() :
- new SuperListIterableWrapper<ReadOnlyJoinColumn>(overriddenStrategy.getSpecifiedJoinColumns());
- }
-
- protected void moveSpecifiedJoinColumn(int index, OrmVirtualJoinColumn joinColumn) {
- this.specifiedJoinColumnContainer.moveContextElement(index, joinColumn);
- }
-
- protected OrmVirtualJoinColumn addSpecifiedJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- return this.specifiedJoinColumnContainer.addContextElement(index, joinColumn);
- }
-
- protected void removeSpecifiedJoinColumn(OrmVirtualJoinColumn joinColumn) {
- this.specifiedJoinColumnContainer.removeContextElement(joinColumn);
- }
-
- protected ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn> buildSpecifiedJoinColumnContainer() {
- return new SpecifiedJoinColumnContainer();
- }
-
- /**
- * specified join column container
- */
- protected class SpecifiedJoinColumnContainer
- extends ContextListContainer<OrmVirtualJoinColumn, ReadOnlyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.buildJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getOverriddenSpecifiedJoinColumns();
- }
- @Override
- protected ReadOnlyJoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) {
- return contextElement.getOverriddenColumn();
- }
- }
-
- protected OrmReadOnlyJoinColumn.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() {
- ReadOnlyJoinColumn 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 ReadOnlyJoinColumn getOverriddenDefaultJoinColumn() {
- ReadOnlyJoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
- return (overriddenStrategy == null) ? null : overriddenStrategy.getDefaultJoinColumn();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmVirtualOverrideRelationship getParent() {
- return (OrmVirtualOverrideRelationship) super.getParent();
- }
-
- public OrmVirtualOverrideRelationship getRelationship() {
- return this.getParent();
- }
-
- protected ReadOnlyJoinColumnRelationshipStrategy getOverriddenStrategy() {
- ReadOnlyJoinColumnRelationship relationship = this.getOverriddenJoinColumnRelationship();
- return (relationship == null) ? null : relationship.getJoinColumnStrategy();
- }
-
- protected ReadOnlyJoinColumnRelationship getOverriddenJoinColumnRelationship() {
- ReadOnlyRelationship relationship = this.resolveOverriddenRelationship();
- return (relationship instanceof ReadOnlyJoinColumnRelationship) ? (ReadOnlyJoinColumnRelationship) relationship : null;
- }
-
- protected ReadOnlyRelationship resolveOverriddenRelationship() {
- return this.getRelationship().resolveOverriddenRelationship();
- }
-
- public boolean isTargetForeignKey() {
- RelationshipMapping relationshipMapping = this.getRelationshipMapping();
- return (relationshipMapping != null) &&
- relationshipMapping.getRelationship().isTargetForeignKey();
- }
-
- public TypeMapping getRelationshipSource() {
- return this.isTargetForeignKey() ?
- // relationship mapping is not null
- this.getRelationshipMapping().getResolvedTargetEntity() :
- this.getRelationship().getTypeMapping();
- }
-
- public TypeMapping getRelationshipTarget() {
- return this.isTargetForeignKey() ?
- this.getRelationship().getTypeMapping() :
- // relationship mapping may still be null
- 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.getRelationship().getMapping();
- }
-
- public String getTableName() {
- return this.isTargetForeignKey() ?
- this.getTargetDefaultTableName() :
- this.getRelationship().getDefaultTableName();
- }
-
- protected String getTargetDefaultTableName() {
- TypeMapping typeMapping = this.getRelationshipMapping().getResolvedTargetEntity();
- return (typeMapping == null) ? null : typeMapping.getPrimaryTableName();
- }
-
- protected Table resolveDbTable(String tableName) {
- return this.isTargetForeignKey() ?
- this.resolveTargetDbTable(tableName) :
- this.getRelationship().resolveDbTable(tableName);
- }
-
- protected Table resolveTargetDbTable(String tableName) {
- TypeMapping typeMapping = this.getRelationshipMapping().getResolvedTargetEntity();
- return (typeMapping == null) ? null : typeMapping.resolveDbTable(tableName);
- }
-
- protected boolean tableNameIsInvalid(String tableName) {
- return this.isTargetForeignKey() ?
- this.targetTableNameIsInvalid(tableName) :
- this.getRelationship().tableNameIsInvalid(tableName);
- }
-
- protected boolean targetTableNameIsInvalid(String tableName) {
- TypeMapping typeMapping = this.getRelationshipMapping().getResolvedTargetEntity();
- return (typeMapping != null) && typeMapping.tableNameIsInvalid(tableName);
- }
-
- protected Table getReferencedColumnDbTable() {
- TypeMapping relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
- }
-
- protected Iterable<String> getCandidateTableNames() {
- return this.isTargetForeignKey() ?
- this.getTargetCandidateTableNames() :
- this.getRelationship().getCandidateTableNames();
- }
-
- protected Iterable<String> getTargetCandidateTableNames() {
- TypeMapping typeMapping = this.getRelationshipMapping().getResolvedTargetEntity();
- return (typeMapping != null) ? typeMapping.getAllAssociatedTableNames() : EmptyIterable.<String>instance();
- }
-
- public TextRange getValidationTextRange() {
- return this.getRelationship().getValidationTextRange();
- }
-
- protected String getAttributeName() {
- return this.getRelationship().getAttributeName();
- }
-
- protected OrmVirtualJoinColumn buildJoinColumn(ReadOnlyJoinColumn overriddenJoinColumn) {
- return this.getContextNodeFactory().buildOrmVirtualJoinColumn(this, this.joinColumnOwner, overriddenJoinColumn);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- for (OrmVirtualJoinColumn joinColumn : this.getJoinColumns()) {
- joinColumn.validate(messages, reporter);
- }
- }
-
-
- // ********** join column owner **********
-
- protected class JoinColumnOwner
- implements OrmReadOnlyJoinColumn.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 tableNameIsInvalid(String tableName) {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getCandidateTableNames();
- }
-
- public Table resolveDbTable(String tableName) {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.resolveDbTable(tableName);
- }
-
- public Table getReferencedColumnDbTable() {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return false;
- }
-
- public int getJoinColumnsSize() {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getValidationTextRange();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationship().buildColumnValidator((ReadOnlyBaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
deleted file mode 100644
index 40963fec84..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java
+++ /dev/null
@@ -1,295 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> virtual secondary table
- */
-public class GenericOrmVirtualSecondaryTable
- extends AbstractOrmVirtualTable<JavaSecondaryTable>
- implements OrmVirtualSecondaryTable
-{
-
- protected final ContextListContainer<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumnContainer;
- protected final OrmReadOnlyBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
-
- protected OrmVirtualPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
-
-
- public GenericOrmVirtualSecondaryTable(OrmEntity parent, Owner owner, JavaSecondaryTable overriddenTable) {
- super(parent, owner, overriddenTable);
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.specifiedPrimaryKeyJoinColumnContainer = this.buildSpecifiedPrimaryKeyJoinColumnContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedPrimaryKeyJoinColumns();
- this.updateDefaultPrimaryKeyJoinColumn();
- }
-
-
- // ********** primary key join columns **********
-
- public ListIterable<OrmVirtualPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
- }
-
- public int getPrimaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
- }
-
-
- // ********** specified primary key join columns **********
-
- public ListIterable<OrmVirtualPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumnsSize() != 0;
- }
-
- public OrmVirtualPrimaryKeyJoinColumn getSpecifiedPrimaryKeyJoinColumn(int index) {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElement(index);
- }
-
- protected void updateSpecifiedPrimaryKeyJoinColumns() {
- this.specifiedPrimaryKeyJoinColumnContainer.update();
- }
-
- protected ListIterable<JavaPrimaryKeyJoinColumn> getOverriddenPrimaryKeyJoinColumns() {
- return this.getOverriddenTable().getSpecifiedPrimaryKeyJoinColumns();
- }
-
- protected void moveSpecifiedPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
- this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(index, pkJoinColumn);
- }
-
- protected OrmVirtualPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn javaColumn) {
- return this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(index, javaColumn);
- }
-
- protected void removeSpecifiedPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) {
- this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(pkJoinColumn);
- }
-
- protected ContextListContainer<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn> buildSpecifiedPrimaryKeyJoinColumnContainer() {
- return new SpecifiedPrimaryKeyJoinColumnContainer();
- }
-
- /**
- * specified primary key join column container
- */
- protected class SpecifiedPrimaryKeyJoinColumnContainer
- extends ContextListContainer<OrmVirtualPrimaryKeyJoinColumn, JavaPrimaryKeyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmVirtualPrimaryKeyJoinColumn buildContextElement(JavaPrimaryKeyJoinColumn resourceElement) {
- return GenericOrmVirtualSecondaryTable.this.buildPrimaryKeyJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<JavaPrimaryKeyJoinColumn> getResourceElements() {
- return GenericOrmVirtualSecondaryTable.this.getOverriddenPrimaryKeyJoinColumns();
- }
- @Override
- protected JavaPrimaryKeyJoinColumn getResourceElement(OrmVirtualPrimaryKeyJoinColumn contextElement) {
- return contextElement.getOverriddenColumn();
- }
- }
-
-
- // ********** 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 OrmReadOnlyBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() {
- return new PrimaryKeyJoinColumnOwner();
- }
-
- protected OrmVirtualPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn javaColumn) {
- return this.getContextNodeFactory().buildOrmVirtualPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, javaColumn);
- }
-
-
- // ********** 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) {
- this.validateNodes(this.getPrimaryKeyJoinColumns(), messages, reporter);
- }
- }
-
-
- // ********** 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 OrmReadOnlyBaseJoinColumn.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.getJoinColumnsSize() != 1) {
- return null;
- }
- Entity parentEntity = this.getEntity().getParentEntity();
- return (parentEntity != null) ?
- parentEntity.getPrimaryKeyColumnName() :
- this.getEntity().getPrimaryKeyColumnName();
- }
-
- public Table resolveDbTable(String tableName) {
- return GenericOrmVirtualSecondaryTable.this.getDbTable();
- }
-
- public int getJoinColumnsSize() {
- return GenericOrmVirtualSecondaryTable.this.getPrimaryKeyJoinColumnsSize();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmVirtualSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
- }
-
- public Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmVirtualSecondaryTable.this.getValidationTextRange();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericOrmVirtualSecondaryTable.this, (ReadOnlyBaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java
deleted file mode 100644
index 4711bbc93a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-
-public class GenericOrmXmlContextNodeFactory
- extends AbstractOrmXmlContextNodeFactory
-{
- // nothing
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java
deleted file mode 100644
index 9902535c1d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,129 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
-import org.eclipse.jpt.jpa.db.Table;
-
-public class NullOrmJoinTableRelationshipStrategy
- extends AbstractOrmXmlContextNode
- implements OrmMappingJoinTableRelationshipStrategy2_0
-{
- 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 this.getRelationship().getValidationTextRange();
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- throw new UnsupportedOperationException();
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver 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 ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return null;
- }
-
- public void addStrategy() {
- // NOP
- }
-
- public void removeStrategy() {
- // NOP
- }
-
- public boolean isOverridable() {
- return false;
- }
-
- public boolean validatesAgainstDatabase() {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java
deleted file mode 100644
index d5f514a9a0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java
+++ /dev/null
@@ -1,28 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-
-public class OrmBaseColumnTextRangeResolver
- extends AbstractOrmNamedColumnTextRangeResolver<OrmReadOnlyBaseColumn>
- implements BaseColumnTextRangeResolver
-{
-
- public OrmBaseColumnTextRangeResolver(OrmReadOnlyBaseColumn column) {
- super(column);
- }
-
- public TextRange getTableTextRange() {
- return this.column.getTableTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java
deleted file mode 100644
index 503127b997..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmBasicMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmBasicMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmBasicMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlBasic(),
- XmlBasic.class);
- }
-
- public OrmBasicMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmBasicMapping(parent, (XmlBasic) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java
deleted file mode 100644
index 44b9ef4904..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-/**
- * default ORM Embeddable provider
- */
-public class OrmEmbeddableDefinition
- implements OrmTypeMappingDefinition
-{
- // singleton
- private static final OrmEmbeddableDefinition INSTANCE =
- new OrmEmbeddableDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmEmbeddableDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
- }
-
- public XmlTypeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlEmbeddable(),
- XmlEmbeddable.class);
- }
-
- public OrmEmbeddable buildContextMapping(
- OrmPersistentType parent,
- XmlTypeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmEmbeddable(parent, (XmlEmbeddable) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java
deleted file mode 100644
index 5f73e84734..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmEmbeddedIdMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmEmbeddedIdMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmEmbeddedIdMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlEmbeddedId(),
- XmlEmbeddedId.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmEmbeddedIdMapping(parent, (XmlEmbeddedId) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java
deleted file mode 100644
index 1f05a77656..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmEmbeddedMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmEmbeddedMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmEmbeddedMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlEmbedded(),
- XmlEmbedded.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmEmbeddedMapping(parent, (XmlEmbedded) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java
deleted file mode 100644
index ef4931f35b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-/**
- * default ORM Entity provider
- */
-public class OrmEntityDefinition
- implements OrmTypeMappingDefinition
-{
- // singleton
- private static final OrmEntityDefinition INSTANCE =
- new OrmEntityDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmEntityDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ENTITY_TYPE_MAPPING_KEY;
- }
-
- public XmlTypeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlEntity(),
- XmlEntity.class);
- }
-
- public OrmEntity buildContextMapping(
- OrmPersistentType parent,
- XmlTypeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmEntity(parent, (XmlEntity) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java
deleted file mode 100644
index af7d7c03c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver;
-
-public class OrmEntityTextRangeResolver
- implements EntityTextRangeResolver
-{
- private OrmEntity entity;
-
-
- public OrmEntityTextRangeResolver(OrmEntity entity) {
- this.entity = entity;
- }
-
-
- public TextRange getTypeMappingTextRange() {
- return this.entity.getValidationTextRange();
- }
-
- public TextRange getIdClassTextRange() {
- return this.entity.getIdClassReference().getValidationTextRange();
- }
-
- public TextRange getAttributeMappingTextRange(String attributeName) {
- return this.getAttributeNamed(attributeName).getValidationTextRange();
- }
-
- protected OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) {
- return this.entity.getPersistentType().getAttributeNamed(attributeName);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java
deleted file mode 100644
index e20a2a6f45..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmIdMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmIdMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmIdMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlId(),
- XmlId.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmIdMapping(parent, (XmlId) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java
deleted file mode 100644
index 269baad85c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,32 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-
-public class OrmJoinColumnTextRangeResolver
- extends AbstractOrmNamedColumnTextRangeResolver<OrmReadOnlyJoinColumn>
- implements JoinColumnTextRangeResolver
-{
-
- public OrmJoinColumnTextRangeResolver(OrmReadOnlyJoinColumn column) {
- super(column);
- }
-
- public TextRange getTableTextRange() {
- return this.column.getTableTextRange();
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.column.getReferencedColumnNameTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java
deleted file mode 100644
index f3eac3d4cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmManyToManyMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmManyToManyMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmManyToManyMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlManyToMany(),
- XmlManyToMany.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmManyToManyMapping(parent, (XmlManyToMany) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java
deleted file mode 100644
index a8a8a41efc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmManyToOneMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmManyToOneMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmManyToOneMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlManyToOne(),
- XmlManyToOne.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmManyToOneMapping(parent, (XmlManyToOne) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java
deleted file mode 100644
index e0328eb994..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-/**
- * default ORM MappedSuperclass definition
- */
-public class OrmMappedSuperclassDefinition
- implements OrmTypeMappingDefinition
-{
- // singleton
- private static final OrmMappedSuperclassDefinition INSTANCE =
- new OrmMappedSuperclassDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmMappedSuperclassDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY;
- }
-
- public XmlTypeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlMappedSuperclass(),
- XmlMappedSuperclass.class);
- }
-
- public OrmMappedSuperclass buildContextMapping(
- OrmPersistentType parent,
- XmlTypeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmMappedSuperclass(parent, (XmlMappedSuperclass) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java
deleted file mode 100644
index 03c139a93e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-
-public class OrmMappedSuperclassTextRangeResolver
- implements PrimaryKeyTextRangeResolver
-{
- private OrmMappedSuperclass mappedSuperclass;
-
-
- public OrmMappedSuperclassTextRangeResolver(OrmMappedSuperclass mappedSuperclass) {
- this.mappedSuperclass = mappedSuperclass;
- }
-
-
- public TextRange getTypeMappingTextRange() {
- return this.mappedSuperclass.getValidationTextRange();
- }
-
- public TextRange getIdClassTextRange() {
- return this.mappedSuperclass.getIdClassReference().getValidationTextRange();
- }
-
- public TextRange getAttributeMappingTextRange(String attributeName) {
- return this.getAttributeNamed(attributeName).getValidationTextRange();
- }
-
- protected OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) {
- return this.mappedSuperclass.getPersistentType().getAttributeNamed(attributeName);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java
deleted file mode 100644
index 0b1cd614c1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java
+++ /dev/null
@@ -1,20 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyNamedColumn;
-
-public class OrmNamedColumnTextRangeResolver
- extends AbstractOrmNamedColumnTextRangeResolver<OrmReadOnlyNamedColumn>
-{
- public OrmNamedColumnTextRangeResolver(OrmReadOnlyNamedColumn column) {
- super(column);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java
deleted file mode 100644
index ce0214dcd2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmOneToManyMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmOneToManyMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmOneToManyMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlOneToMany(),
- XmlOneToMany.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmOneToManyMapping(parent, (XmlOneToMany) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java
deleted file mode 100644
index 722738c39c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmOneToOneMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmOneToOneMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmOneToOneMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlOneToOne(),
- XmlOneToOne.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmOneToOneMapping(parent, (XmlOneToOne) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java
deleted file mode 100644
index 5f90af8a8d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java
+++ /dev/null
@@ -1,28 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-
-public class OrmOverrideTextRangeResolver
- implements OverrideTextRangeResolver
-{
- protected final OrmReadOnlyOverride ormOverride;
-
- public OrmOverrideTextRangeResolver(OrmReadOnlyOverride ormOverride) {
- this.ormOverride = ormOverride;
- }
-
- public TextRange getNameTextRange() {
- return this.ormOverride.getNameTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java
deleted file mode 100644
index fe9b812e24..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-
-public class OrmPersistentAttributeTextRangeResolver
- implements PersistentAttributeTextRangeResolver
-{
- private OrmPersistentAttribute persistentAttribute;
-
- public OrmPersistentAttributeTextRangeResolver(OrmPersistentAttribute persistentAttribute) {
- this.persistentAttribute = persistentAttribute;
- }
-
- public TextRange getAttributeTextRange() {
- return this.persistentAttribute.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java
deleted file mode 100644
index 385aef2de5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java
+++ /dev/null
@@ -1,28 +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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-
-public class OrmPrimaryKeyJoinColumnTextRangeResolver
- extends AbstractOrmNamedColumnTextRangeResolver<OrmReadOnlyBaseJoinColumn>
- implements BaseJoinColumnTextRangeResolver
-{
-
- public OrmPrimaryKeyJoinColumnTextRangeResolver(OrmReadOnlyBaseJoinColumn column) {
- super(column);
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.column.getReferencedColumnNameTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java
deleted file mode 100644
index 62ef537690..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyTable;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-
-public class OrmTableTextRangeResolver
- implements TableTextRangeResolver
-{
- protected final OrmReadOnlyTable table;
-
-
- public OrmTableTextRangeResolver(OrmReadOnlyTable table) {
- super();
- this.table = table;
- }
-
- public TextRange getNameTextRange() {
- return this.table.getNameTextRange();
- }
-
- public TextRange getCatalogTextRange() {
- return this.table.getCatalogTextRange();
- }
-
- public TextRange getSchemaTextRange() {
- return this.table.getSchemaTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java
deleted file mode 100644
index 2f5e612f3a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmTransientMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmTransientMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmTransientMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlTransient(),
- XmlTransient.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmTransientMapping(parent, (XmlTransient) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java
deleted file mode 100644
index 3a769597e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
-
-public class OrmTypeMappingTextRangeResolver
- implements TypeMappingTextRangeResolver
-{
- private OrmTypeMapping typeMapping;
-
- public OrmTypeMappingTextRangeResolver(OrmTypeMapping typeMapping) {
- this.typeMapping = typeMapping;
- }
-
- public TextRange getTypeMappingTextRange() {
- return this.typeMapping.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java
deleted file mode 100644
index cf82474d55..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmVersionMappingDefinition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmVersionMappingDefinition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmVersionMappingDefinition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlVersion(),
- XmlVersion.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping resourceMapping,
- OrmXmlContextNodeFactory factory) {
- return factory.buildOrmVersionMapping(parent, (XmlVersion) resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
deleted file mode 100644
index 6d23dc71b6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java
+++ /dev/null
@@ -1,543 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.CollectionMapping;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <em>specified</em> <code>orm.xml</code> persistent attribute
- */
-public abstract class SpecifiedOrmPersistentAttribute
- extends AbstractOrmXmlContextNode
- implements OrmPersistentAttribute2_0
-{
- protected OrmAttributeMapping mapping; // never null
-
- /**
- * This will point to one of the following:<ul>
- * <li>an existing Java attribute (taken from the appropriate Java type)
- * <li>{@link #cachedJavaPersistentAttribute} if there is no such Java
- * attribute (i.e. the Java type's access type is different or it is
- * inherited from a non-persistent superclass)
- * <li><code>null</code> if there is no matching Java resource attribute
- * </ul>
- * @see #buildJavaPersistentAttribute()
- */
- protected JavaPersistentAttribute javaPersistentAttribute;
-
- /**
- * If present, this Java attribute's parent is the <code>orm.xml</code>
- * type.
- */
- protected JavaPersistentAttribute cachedJavaPersistentAttribute;
-
- protected AccessType specifiedAccess;
- protected AccessType defaultAccess;
-
-
- protected SpecifiedOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
- super(parent);
- this.mapping = this.buildMapping(xmlMapping);
- this.specifiedAccess = this.buildSpecifiedAccess();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedAccess_(this.buildSpecifiedAccess());
- 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();
- }
-
- public JavaResourceAttribute getJavaResourceAttribute() {
- return this.javaPersistentAttribute == null ? null : this.javaPersistentAttribute.getResourceAttribute();
- }
-
- public boolean isFor(JavaResourceField javaResourceField) {
- return getJavaPersistentAttribute() == null ? false : getJavaPersistentAttribute().isFor(javaResourceField);
- }
-
- public boolean isFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
- return getJavaPersistentAttribute() == null ? false : getJavaPersistentAttribute().isFor(javaResourceGetter, javaResourceSetter);
- }
-
- 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.getOwningPersistentTypeJavaType();
- 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() {
- JavaResourceType javaResourceType = this.getOwningPersistentTypeJavaType().getJavaResourceType();
- if (getAccess() == AccessType.FIELD) {
- JavaResourceField javaResourceField = this.getJavaResourceField(javaResourceType);
- if (javaResourceField == null) {
- // nothing in the resource inheritance hierarchy matches our name *and* access type
- this.cachedJavaPersistentAttribute = null;
- } else {
- if ((this.cachedJavaPersistentAttribute == null) ||
- !(this.cachedJavaPersistentAttribute.isFor(javaResourceField))) {
- // cache is stale
- this.cachedJavaPersistentAttribute = this.buildJavaPersistentField(javaResourceField);
- }
- }
- }
- if (getAccess() == AccessType.PROPERTY) {
- JavaResourceMethod javaResourceGetter = this.getJavaResourceGetter(javaResourceType);
- JavaResourceMethod javaResourceSetter = AbstractJavaPersistentType.getValidSiblingSetMethod(javaResourceGetter, javaResourceType.getMethods());
- if (javaResourceGetter == null && javaResourceSetter == null) {
- // nothing in the resource inheritance hierarchy matches our name *and* access type
- this.cachedJavaPersistentAttribute = null;
- } else {
- if ((this.cachedJavaPersistentAttribute == null) ||
- !(this.cachedJavaPersistentAttribute.isFor(javaResourceGetter, javaResourceSetter))) {
- // cache is stale
- this.cachedJavaPersistentAttribute = this.buildJavaPersistentProperty(javaResourceGetter, javaResourceSetter);
- }
- }
- }
- return this.cachedJavaPersistentAttribute;
- }
-
- /**
- * Search the specified Java resource type for the resource attribute
- * corresponding to this <code>orm.xml</code> attribute (i.e. the Java
- * resource attribute with the same name). If the specified Java resource
- * type does not have a corresponding attribute, search up its inheritance
- * hierarchy.
- */
- protected JavaResourceField getJavaResourceField(JavaResourceType javaResourceType) {
- for (JavaResourceField javaResourceField : this.getJavaResourceFields(javaResourceType)) {
- if (javaResourceField.getName().equals(this.getName())) {
- return javaResourceField;
- }
- }
- // climb up inheritance hierarchy
- String superclassName = javaResourceType.getSuperclassQualifiedName();
- if (superclassName == null) {
- return null;
- }
- JavaResourceType superclass = (JavaResourceType) this.getJpaProject().getJavaResourceType(superclassName, Kind.TYPE);
- if (superclass == null) {
- return null;
- }
- // recurse
- return this.getJavaResourceField(superclass);
- }
-
- /**
- * Return the resource attributes with compatible access types.
- */
- protected Iterable<JavaResourceField> getJavaResourceFields(JavaResourceType javaResourceType) {
- return javaResourceType.getFields();
- }
-
- /**
- * Search the specified Java resource type for the resource attribute
- * corresponding to this <code>orm.xml</code> attribute (i.e. the Java
- * resource attribute with the same name). If the specified Java resource
- * type does not have a corresponding attribute, search up its inheritance
- * hierarchy.
- */
- protected JavaResourceMethod getJavaResourceGetter(JavaResourceType javaResourceType) {
- for (JavaResourceMethod javaResourceGetter : this.getJavaResourceGetters(javaResourceType)) {
- if (javaResourceGetter.getName().equals(this.getName())) {
- return javaResourceGetter;
- }
- }
- // climb up inheritance hierarchy
- String superclassName = javaResourceType.getSuperclassQualifiedName();
- if (superclassName == null) {
- return null;
- }
- JavaResourceType superclass = (JavaResourceType) this.getJpaProject().getJavaResourceType(superclassName, Kind.TYPE);
- if (superclass == null) {
- return null;
- }
- // recurse
- return this.getJavaResourceGetter(superclass);
- }
-
- protected Iterable<JavaResourceMethod> getResourceMethods(final JavaResourceType javaResourceType, Filter<JavaResourceMethod> filter) {
- return new FilteringIterable<JavaResourceMethod>(javaResourceType.getMethods(), filter);
- }
-
- protected Filter<JavaResourceMethod> buildPersistablePropertyGetterMethodsFilter(final JavaResourceType javaResourceType) {
- return new Filter<JavaResourceMethod>() {
- public boolean accept(JavaResourceMethod resourceMethod) {
- return AbstractJavaPersistentType.methodIsPersistablePropertyGetter(resourceMethod, javaResourceType.getMethods());
- }
- };
- }
-
- /**
- * Return the resource attributes with compatible access types.
- */
- protected Iterable<JavaResourceMethod> getJavaResourceGetters(JavaResourceType javaResourceType) {
- return getResourceMethods(javaResourceType, buildPersistablePropertyGetterMethodsFilter(javaResourceType));
- }
-
- protected JavaPersistentAttribute buildJavaPersistentField(JavaResourceField javaResourceField) {
- // pass in our parent orm persistent type as the parent to the cached Java attribute...
- return this.getJpaFactory().buildJavaPersistentField(this.getOwningPersistentType(), javaResourceField);
- }
-
- protected JavaPersistentAttribute buildJavaPersistentProperty(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
- // pass in our parent orm persistent type as the parent to the cached Java attribute...
- return this.getJpaFactory().buildJavaPersistentProperty(this.getOwningPersistentType(), javaResourceGetter, javaResourceSetter);
- }
-
-
- // ********** access **********
-
- public AccessType getAccess() {
- AccessType specifiedAccess = this.getSpecifiedAccess();
- return (specifiedAccess != null) ? specifiedAccess : this.defaultAccess;
- }
-
- 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();
- }
-
- 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();
- }
-
-
- // ********** specified/default **********
-
- 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 getOwningPersistentTypeJavaType() {
- return this.getOwningPersistentType().getJavaPersistentType();
- }
-
- public OrmTypeMapping getOwningTypeMapping() {
- return this.getOwningPersistentType().getMapping();
- }
-
- public String getPrimaryKeyColumnName() {
- return this.mapping.getPrimaryKeyColumnName();
- }
-
- public String getTypeName() {
- return (this.javaPersistentAttribute == null) ? null : this.javaPersistentAttribute.getTypeName();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java
deleted file mode 100644
index a8adf954b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java
+++ /dev/null
@@ -1,381 +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.jpa.core.internal.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.model.event.StateChangeEvent;
-import org.eclipse.jpt.common.utility.model.listener.StateChangeListener;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.java.Accessor;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.java.FieldAccessor;
-import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmReadOnlyPersistentAttribute2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <em>virtual</em> <code>orm.xml</code> persistent attribute
- */
-public class VirtualOrmPersistentAttribute
- extends AbstractOrmXmlContextNode
- implements OrmReadOnlyPersistentAttribute2_0
-{
- protected final Accessor javaAccessor;
-
- /**
- * 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 <em>context</em> 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).
- * The {@link #originalJavaAttributeListener} keeps this attribute in sync
- * with any changes made via the Java context model.
- */
- 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 access type), 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 and we will <em>sync</em> appropriately).
- */
- 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.
- * The {@link #originalJavaAttributeListener} keeps this attribute in sync
- * with any changes made via the Java context model.
- */
- protected JavaPersistentAttribute unannotatedJavaAttribute;
-
- protected JavaAttributeMapping mapping; // never null
-
-
- public VirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourceField resourceField) {
- super(parent);
- this.javaAccessor = new FieldAccessor(this, resourceField);
- this.annotatedJavaAttribute = this.buildAnnotatedJavaAttribute();
- this.mapping = this.buildMapping();
- }
-
- public VirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
- super(parent);
- this.javaAccessor = new PropertyAccessor(this, resourceGetter, resourceSetter);
- this.annotatedJavaAttribute = this.buildAnnotatedJavaAttribute();
- this.mapping = this.buildMapping();
- }
-
- public VirtualOrmPersistentAttribute(OrmPersistentType parent, Accessor javaAccessor) {
- super(parent);
- this.javaAccessor = javaAccessor;
- 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.getJavaResourceAttribute());
- }
-
- protected JavaPersistentAttribute2_0 getJavaPersistentAttribute2_0() {
- return (JavaPersistentAttribute2_0) this.getJavaPersistentAttribute();
- }
-
- protected JavaPersistentAttribute buildAnnotatedJavaAttribute() {
- return buildJavaAttribute(this.javaAccessor);
- }
-
- protected JavaPersistentAttribute getUnannotatedJavaAttribute() {
- if (this.unannotatedJavaAttribute == null) {
- this.unannotatedJavaAttribute = this.buildUnannotatedJavaAttribute();
- }
- return this.unannotatedJavaAttribute;
- }
-
- protected JavaPersistentAttribute buildUnannotatedJavaAttribute() {
- // pass in the orm persistent type as the parent...
- return this.javaAccessor.buildUnannotatedJavaAttribute(this.getOwningPersistentType());
- }
-
- protected JavaPersistentAttribute buildJavaAttribute(Accessor accessor) {
- // pass in the orm persistent type as the parent...
- return this.getJpaFactory().buildJavaPersistentAttribute(this.getOwningPersistentType(), accessor);
- }
-
- 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 Accessor getJavaAccessor() {
- return this.javaAccessor;
- }
-
- public JavaResourceAttribute getJavaResourceAttribute() {
- return this.javaAccessor.getResourceAttribute();
- }
-
- public boolean isFor(JavaResourceField javaResourceField) {
- return this.javaAccessor.isFor(javaResourceField);
- }
-
- public boolean isFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
- return this.javaAccessor.isFor(javaResourceGetter, javaResourceSetter);
- }
-
- // ********** 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/default **********
-
- 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 **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // the Java attribute should not need an AST for validation from here
- this.getJavaPersistentAttribute().validate(messages, reporter, null);
- }
-
- 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());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
deleted file mode 100644
index d38f369ce3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java
+++ /dev/null
@@ -1,388 +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.jpa.core.internal.context.persistence;
-
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JarFile;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>persistence.xml</code> file
- * <br>
- * <code>jar-file</code> element
- */
-public abstract class AbstractJarFileRef
- extends AbstractPersistenceXmlContextNode
- implements JarFileRef
-{
- protected final XmlJarFileRef xmlJarFileRef;
-
- protected String fileName;
-
- /**
- * the jar file corresponding to the ref's file name;
- * this can be null if the name is invalid
- */
- protected JarFile jarFile;
-
-
- // ********** construction/initialization **********
-
- public AbstractJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
- super(parent);
- this.xmlJarFileRef = xmlJarFileRef;
- this.fileName = xmlJarFileRef.getFileName();
- this.jarFile = this.buildJarFile();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setFileName_(this.xmlJarFileRef.getFileName());
- this.syncJarFile();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJarFile();
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return PersistenceStructureNodes.JAR_FILE_REF_ID;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- return this;
- }
-
- public TextRange getSelectionTextRange() {
- return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getSelectionTextRange();
- }
-
- public void dispose() {
- if (this.jarFile != null) {
- this.jarFile.dispose();
- }
- }
-
-
- // ********** file name **********
-
- public String getFileName() {
- return this.fileName;
- }
-
- public void setFileName(String fileName) {
- this.setFileName_(fileName);
- this.xmlJarFileRef.setFileName(fileName);
- }
-
- /**
- * We clear out {@link #jarFile} here because we cannot compare its file
- * name to the ref's file name, since it may have been munged (see
- * {@link #resolveJavaResourcePackageFragmentRoot_()}).
- */
- protected void setFileName_(String fileName) {
- String old = this.fileName;
- this.fileName = fileName;
- if (this.firePropertyChanged(FILE_NAME_PROPERTY, old, fileName)) {
- // clear out the jar file here, it will be rebuilt during "update"
- if (this.jarFile != null) {
- this.jarFile.dispose();
- this.setJarFile(null);
- }
- }
- }
-
-
- // ********** jar file **********
-
- public JarFile getJarFile() {
- return this.jarFile;
- }
-
- protected void setJarFile(JarFile jarFile) {
- JarFile old = this.jarFile;
- this.jarFile = jarFile;
- this.firePropertyChanged(JAR_FILE_PROPERTY, old, jarFile);
- }
-
- protected JarFile buildJarFile() {
- JavaResourcePackageFragmentRoot jrpfr = this.resolveJavaResourcePackageFragmentRoot();
- return (jrpfr == null) ? null : this.buildJarFile(jrpfr);
- }
-
- /**
- * If the file name changes during <em>sync</em>, the jar file will be
- * cleared out in {@link #setFileName_(String)}. If we get here and the jar
- * file is still present, we can <code>sync</code> it. Of course, it might
- * still be obsolete if other things have changed....
- *
- * @see #updateJarFile()
- */
- protected void syncJarFile() {
- if (this.jarFile != null) {
- this.jarFile.synchronizeWithResourceModel();
- }
- }
-
- /**
- * @see #syncJarFile()
- */
- protected void updateJarFile() {
- JavaResourcePackageFragmentRoot jrpfr = this.resolveJavaResourcePackageFragmentRoot();
- if (jrpfr == null) {
- if (this.jarFile != null) {
- this.jarFile.dispose();
- this.setJarFile(null);
- }
- } else {
- if (this.jarFile == null) {
- this.setJarFile(this.buildJarFile(jrpfr));
- } else {
- if (this.jarFile.getJarResourcePackageFragmentRoot() == jrpfr) {
- this.jarFile.update();
- } else {
- this.jarFile.dispose();
- this.setJarFile(this.buildJarFile(jrpfr));
- }
- }
- }
- }
-
- protected JavaResourcePackageFragmentRoot resolveJavaResourcePackageFragmentRoot() {
- return StringTools.stringIsEmpty(this.fileName) ? null : this.resolveJavaResourcePackageFragmentRoot_();
- }
-
- /**
- * pre-condition: 'fileName' is neither null nor empty
- */
- protected JavaResourcePackageFragmentRoot resolveJavaResourcePackageFragmentRoot_() {
- // first, attempt to resolve location specifically...
- JavaResourcePackageFragmentRoot jrpfr = this.resolveJrpfrOnDeploymentPath();
- // ...then guess, basically
- return (jrpfr != null) ? jrpfr : this.resolveJrpfrBestMatch();
- }
-
- /**
- * pre-condition: 'fileName' is neither null nor empty
- */
- protected JavaResourcePackageFragmentRoot resolveJrpfrOnDeploymentPath() {
- for (IPath runtimePath : this.buildRuntimeJarFilePath(new Path(this.fileName))) {
- IVirtualFile virtualJar = ComponentCore.createFile(this.getProject(), runtimePath);
- IFile realJar = virtualJar.getUnderlyingFile();
- if (realJar.exists() && realJar.getProject().equals(this.getProject())) {
- return this.getJpaProject().getJavaResourcePackageFragmentRoot(realJar.getProjectRelativePath().toString());
- }
- }
- return null;
- }
-
- /**
- * Return an array of runtime paths that may correspond
- * to the given persistence.xml jar file entry
- */
- protected IPath[] buildRuntimeJarFilePath(IPath jarFilePath) {
- IPath root = this.getJarRuntimeRootPath();
- return this.projectHasWebFacet() ?
- this.buildRuntimeJarFilePathWeb(root, jarFilePath) :
- this.buildRuntimeJarFilePathNonWeb(root, jarFilePath);
- }
-
- protected IPath getJarRuntimeRootPath() {
- return JptJpaCorePlugin.getJarRuntimeRootPath(this.getProject());
- }
-
- protected boolean projectHasWebFacet() {
- return JptJpaCorePlugin.projectHasWebFacet(this.getProject());
- }
-
- protected IPath[] buildRuntimeJarFilePathWeb(IPath root, IPath jarFilePath) {
- return new IPath[] {
- // first path entry assumes form "../lib/other.jar"
- root.append(jarFilePath.removeFirstSegments(1)),
- // second path entry assumes form of first, without ".." ("lib/other.jar")
- root.append(jarFilePath)
- };
- }
-
- protected IPath[] buildRuntimeJarFilePathNonWeb(IPath root, IPath jarFilePath) {
- return new IPath[] {
- // assumes form "../lib/other.jar"
- root.append(jarFilePath)
- };
- }
-
- protected IProject getProject() {
- return this.getJpaProject().getProject();
- }
-
- /**
- * pre-condition: 'fileName' is neither null nor empty
- */
- protected JavaResourcePackageFragmentRoot resolveJrpfrBestMatch() {
- String jarFileName = new Path(this.fileName).lastSegment();
- for (JpaFile jpaFile : this.getJpaProject().getJarJpaFiles()) {
- if (jpaFile.getFile().getName().equals(jarFileName)) {
- return (JavaResourcePackageFragmentRoot) jpaFile.getResourceModel();
- }
- }
- return null;
- }
-
- /**
- * pre-condition: 'jrpfr' is not null
- */
- protected JarFile buildJarFile(JavaResourcePackageFragmentRoot jrpfr) {
- return this.getContextNodeFactory().buildJarFile(this, jrpfr);
- }
-
-
- // ********** JarFileRef implementation **********
-
- public XmlJarFileRef getXmlJarFileRef() {
- return this.xmlJarFileRef;
- }
-
- public PersistentType getPersistentType(String typeName) {
- return (this.jarFile == null) ? null : this.jarFile.getPersistentType(typeName);
- }
-
- public boolean containsOffset(int textOffset) {
- return (this.xmlJarFileRef != null) && this.xmlJarFileRef.containsOffset(textOffset);
- }
-
-
- // ********** PersistentTypeContainer implementation **********
-
- public Iterable<? extends PersistentType> getPersistentTypes() {
- return (this.jarFile != null) ? this.jarFile.getPersistentTypes() : EmptyIterable.<JavaPersistentType>instance();
- }
-
-
- // ********** XmlContextNode implementation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlJarFileRefTextRange();
- return (textRange != null) ? textRange : this.getPersistenceUnit().getValidationTextRange();
- }
-
- protected TextRange getXmlJarFileRefTextRange() {
- return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getValidationTextRange();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createReplaceFolderEdits(IFolder originalFolder, String newName) {
- return this.isIn(originalFolder) ?
- new SingleElementIterable<ReplaceEdit>(this.createReplaceFolderEdit(originalFolder, newName)) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- protected ReplaceEdit createReplaceFolderEdit(IFolder originalFolder, String newName) {
- return this.xmlJarFileRef.createReplaceFolderEdit(originalFolder, newName);
- }
-
- protected boolean isIn(IFolder folder) {
- return (this.jarFile != null) && this.jarFile.isIn(folder);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- if (StringTools.stringIsEmpty(this.xmlJarFileRef.getFileName())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE,
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
-
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING,
- this,
- this.getValidationTextRange()
- )
- );
-
- if (this.jarFile == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE,
- new String[] {this.xmlJarFileRef.getFileName()},
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
-
- this.jarFile.validate(messages, reporter);
- }
-
-
- // ********** overrides **********
-
- @Override
- public PersistenceUnit getParent() {
- return (PersistenceUnit) super.getParent();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.fileName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
deleted file mode 100644
index 8ef469264d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
+++ /dev/null
@@ -1,361 +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.jpa.core.internal.context.persistence;
-
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.context.MappingFile;
-import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>persistence.xml</code> file
- * <br>
- * <code>mapping-file</code> element
- */
-public abstract class AbstractMappingFileRef
- extends AbstractPersistenceXmlContextNode
- implements MappingFileRef
-{
- protected String fileName;
-
- /**
- * The mapping file corresponding to the ref's file name.
- * This can be <code>null</code> if the name is invalid.
- */
- protected MappingFile mappingFile;
-
-
- // ********** construction/initialization **********
-
- protected AbstractMappingFileRef(PersistenceUnit parent, String fileName) {
- super(parent);
- this.fileName = fileName;
- this.mappingFile = this.buildMappingFile();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncMappingFile();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateMappingFile();
- }
-
-
- // ********** file name **********
-
- public String getFileName() {
- return this.fileName;
- }
-
- public boolean isFor(IFile file) {
- return (this.mappingFile != null) && file.equals(this.mappingFile.getXmlResource().getFile());
- }
-
- protected boolean isIn(IFolder folder) {
- return (this.mappingFile != null) && this.mappingFile.isIn(folder);
- }
-
-
- // ********** mapping file **********
-
- public MappingFile getMappingFile() {
- return this.mappingFile;
- }
-
- protected void setMappingFile(MappingFile mappingFile) {
- MappingFile old = this.mappingFile;
- this.mappingFile = mappingFile;
- this.firePropertyChanged(MAPPING_FILE_PROPERTY, old, mappingFile);
- }
-
- protected MappingFile buildMappingFile() {
- JpaXmlResource xmlResource = this.resolveMappingFileXmlResource();
- return (xmlResource == null) ? null : this.buildMappingFile(xmlResource);
- }
-
- protected void syncMappingFile() {
- this.syncMappingFile(true);
- }
-
- /**
- * We call this method from both {@link #syncMappingFile()} and
- * {@link #updateMappingFile()} because<ul>
- * <li>a <em>sync</em> will occur when the file is edited directly;
- * and the user could modify something (e.g. the version number) that
- * triggers the file being "resolved" or not;
- * see {@link #resolveMappingFileXmlResource()}
- * <li>an <em>update</em> will occur whenever the entire file is added or
- * removed
- * </ul>
- */
- protected void syncMappingFile(boolean sync) {
- 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) {
- if (sync) {
- this.mappingFile.synchronizeWithResourceModel();
- } else {
- 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: 'xmlResource' is not <code>null</code>
- */
- protected MappingFile buildMappingFile(JpaXmlResource xmlResource) {
- return this.getJpaFactory().buildMappingFile(this, xmlResource);
- }
-
- protected void updateMappingFile() {
- this.syncMappingFile(false);
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return PersistenceStructureNodes.MAPPING_FILE_REF_ID;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- return this;
- }
-
- public void dispose() {
- if (this.mappingFile != null) {
- this.mappingFile.dispose();
- }
- }
-
-
- // ********** misc **********
-
- public boolean persistenceUnitMetadataExists() {
- MappingFilePersistenceUnitMetadata metadata = this.getPersistenceUnitMetadata();
- return (metadata != null) && metadata.resourceExists();
- }
-
- public MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata() {
- MappingFileRoot root = this.getChildMappingFileRoot();
- return (root == null) ? null : root.getPersistenceUnitMetadata();
- }
-
- /**
- * The method {@link #getMappingFileRoot()} is already defined by
- * {@link org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode}
- * for getting what would be the "mapping file root" that <em>contains</em>
- * the context node. We want something slightly different here: i.e. the
- * "mapping file root" contained by the mapping file ref (since, actually,
- * the mapping file ref is not even contained by a "mapping file root").
- */
- protected MappingFileRoot getChildMappingFileRoot() {
- return (this.mappingFile == null) ? null : this.mappingFile.getRoot();
- }
-
- public PersistentType getPersistentType(String typeName) {
- return (this.mappingFile == null) ? null : this.mappingFile.getPersistentType(typeName);
- }
-
- @Override
- public PersistenceUnit getParent() {
- return (PersistenceUnit) super.getParent();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append(this.fileName);
- }
-
- public Iterable<? extends PersistentType> getPersistentTypes() {
- return (this.mappingFile != null) ? this.mappingFile.getPersistentTypes() : EmptyIterable.<JavaPersistentType>instance();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- if (StringTools.stringIsEmpty(this.fileName)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE,
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
-
- if (this.mappingFile == null) {
- messages.add(this.buildMappingFileValidationMessage());
- return;
- }
-
- this.mappingFile.validate(messages, reporter);
- }
-
- protected IMessage buildMappingFileValidationMessage() {
- int severity = IMessage.HIGH_SEVERITY;
- IFile file = this.getPlatformFile();
- if ( ! file.exists()) {
- return DefaultJpaValidationMessages.buildMessage(
- severity,
- JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE,
- new String[] {this.fileName},
- this,
- this.getValidationTextRange()
- );
- }
- String msgText = this.mappingFileContentIsUnsupported() ?
- JpaValidationMessages.PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT :
- JpaValidationMessages.PERSISTENCE_UNIT_INVALID_MAPPING_FILE;
- return DefaultJpaValidationMessages.buildMessage(
- severity,
- msgText,
- new String[] {file.getName()},
- file
- );
- }
-
- protected IFile getPlatformFile() {
- return this.getJpaProject().getPlatformFile(new Path(this.fileName));
- }
-
- /**
- * pre-condition: {@link #getPlatformFile()} exists
- */
- protected boolean mappingFileContentIsUnsupported() {
- JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName));
- return (xmlResource != null) && ! this.getJpaPlatform().supportsResourceType(xmlResource.getResourceType());
- }
-
-
- // ********** refactoring **********
-
- public Iterable<DeleteEdit> createDeleteTypeEdits(IType type) {
- return (this.mappingFile != null) ?
- this.mappingFile.createDeleteTypeEdits(type) :
- EmptyIterable.<DeleteEdit>instance();
- }
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return (this.mappingFile != null) ?
- this.mappingFile.createRenameTypeEdits(originalType, newName) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return (this.mappingFile != null) ?
- this.mappingFile.createMoveTypeEdits(originalType, newPackage) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return (this.mappingFile != null) ?
- this.mappingFile.createRenamePackageEdits(originalPackage, newName) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- public Iterable<ReplaceEdit> createRenameMappingFileEdits(IFile originalFile, String newName) {
- return this.isFor(originalFile) ?
- new SingleElementIterable<ReplaceEdit>(this.createRenameEdit(originalFile, newName)) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- protected abstract ReplaceEdit createRenameEdit(IFile originalFile, String newName);
-
- public Iterable<ReplaceEdit> createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination) {
- return this.isFor(originalFile) ?
- new SingleElementIterable<ReplaceEdit>(this.createMoveEdit(originalFile, runtineDestination)) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- protected abstract ReplaceEdit createMoveEdit(IFile originalFile, IPath runtineDestination);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
deleted file mode 100644
index 5613b13932..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ /dev/null
@@ -1,2774 +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.jpa.core.internal.context.persistence;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.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.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.utility.BodySourceWriter;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.HashBag;
-import org.eclipse.jpt.common.utility.internal.NotNullFilter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.Generator;
-import org.eclipse.jpt.jpa.core.context.GeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.IdMapping;
-import org.eclipse.jpt.jpa.core.context.MappingFile;
-import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitDefaults;
-import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.Query;
-import org.eclipse.jpt.jpa.core.context.QueryContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.context.java.JavaGenerator;
-import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
-import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitTransactionType;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MappingFilePersistenceUnitDefaults2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode;
-import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperties;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>persistence.xml</code> file
- * <br>
- * <code>persistence-unit</code> element
- */
-public abstract class AbstractPersistenceUnit
- extends AbstractPersistenceXmlContextNode
- implements PersistenceUnit2_0
-{
- protected final XmlPersistenceUnit xmlPersistenceUnit;
-
- protected String name;
-
- protected Boolean specifiedExcludeUnlistedClasses;
-
- protected PersistenceUnitTransactionType specifiedTransactionType;
- protected PersistenceUnitTransactionType defaultTransactionType;
-
- protected String description;
-
- protected String provider;
-
- protected String jtaDataSource;
- protected String nonJtaDataSource;
-
- protected final ContextListContainer<MappingFileRef, XmlMappingFileRef> specifiedMappingFileRefContainer;
- protected MappingFileRef impliedMappingFileRef;
-
- protected final ContextListContainer<JarFileRef, XmlJarFileRef> jarFileRefContainer;
-
- protected final ContextListContainer<ClassRef, XmlJavaClassRef> specifiedClassRefContainer;
-
- protected final ContextCollectionContainer<ClassRef, String> impliedClassRefContainer;
-
- protected final ContextListContainer<Property, XmlProperty> propertyContainer;
-
- /* 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.propertyContainer = this.buildPropertyContainer();
- this.initializeProperties();
-
- this.specifiedMappingFileRefContainer = this.buildSpecifiedMappingFileRefContainer();
- this.jarFileRefContainer = this.buildJarFileRefContainer();
- this.specifiedClassRefContainer = this.buildSpecifiedClassRefContainer();
- this.impliedClassRefContainer = this.buildImpliedClassRefContainer();
-
- this.specifiedSharedCacheMode = this.buildSpecifiedSharedCacheMode();
- this.specifiedValidationMode = this.buildSpecifiedValidationMode();
-
- this.initializeMetamodelFiles();
- }
-
-
- // ********** 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());
- }
-
- @Override
- public void update() {
- super.update();
-
- 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.updateSpecifiedClassRefs();
-
- this.updateSpecifiedMappingFileRefs();
- this.updateImpliedMappingFileRef();
-
- this.updateJarFileRefs();
-
- // 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.updateProperties();
-
- this.updatePersistenceUnitMetadata();
-
- this.setGenerators(this.buildGenerators());
- this.setQueries(this.buildQueries());
-
- this.setDefaultSharedCacheMode(this.buildDefaultSharedCacheMode());
- this.setDefaultValidationMode(this.buildDefaultValidationMode());
- }
-
-
- // ********** JpaContextNode implementation **********
-
- @Override
- public Persistence getParent() {
- return (Persistence) super.getParent();
- }
-
- protected Persistence getPersistence() {
- return this.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 **********
-
- protected Iterable<String> getMappingFileRefNames() {
- return new TransformationIterable<MappingFileRef, String>(this.getMappingFileRefs()) {
- @Override
- protected String transform(MappingFileRef mappingFileRef) {
- return mappingFileRef.getFileName();
- }
- };
- }
-
- public ListIterable<MappingFileRef> getMappingFileRefs() {
- return (this.impliedMappingFileRef == null) ?
- this.getSpecifiedMappingFileRefs() :
- this.getCombinedMappingFileRefs();
- }
-
- protected ListIterable<MappingFileRef> getCombinedMappingFileRefs() {
- return new CompositeListIterable<MappingFileRef>(
- this.getSpecifiedMappingFileRefs(),
- this.impliedMappingFileRef
- );
- }
-
- public int getMappingFileRefsSize() {
- return (this.impliedMappingFileRef == null) ?
- this.getSpecifiedMappingFileRefsSize() :
- this.getCombinedMappingFileRefsSize();
- }
-
- protected int getCombinedMappingFileRefsSize() {
- return this.getSpecifiedMappingFileRefsSize() + 1;
- }
-
- public Iterable<MappingFileRef> getMappingFileRefsContaining(final String typeName) {
- return new FilteringIterable<MappingFileRef> (this.getMappingFileRefs()) {
- @Override
- protected boolean accept(MappingFileRef mappingFileRef) {
- return mappingFileRef.getPersistentType(typeName) != null;
- }
- };
- }
-
-
- // ********** specified mapping file refs **********
-
- public ListIterable<MappingFileRef> getSpecifiedMappingFileRefs() {
- return this.specifiedMappingFileRefContainer.getContextElements();
- }
-
- public int getSpecifiedMappingFileRefsSize() {
- return this.specifiedMappingFileRefContainer.getContextElementsSize();
- }
-
- public MappingFileRef addSpecifiedMappingFileRef(String fileName) {
- return this.addSpecifiedMappingFileRef(this.getSpecifiedMappingFileRefsSize(), fileName);
- }
-
- public MappingFileRef addSpecifiedMappingFileRef(int index, String fileName) {
- XmlMappingFileRef xmlMappingFileRef = this.buildXmlMappingFileRef(fileName);
- MappingFileRef mappingFileRef = this.specifiedMappingFileRefContainer.addContextElement(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.specifiedMappingFileRefContainer.indexOfContextElement(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.specifiedMappingFileRefContainer.removeContextElement(index).dispose();
- }
-
- protected void syncSpecifiedMappingFileRefs() {
- this.specifiedMappingFileRefContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedMappingFileRefs() {
- this.specifiedMappingFileRefContainer.update();
- }
-
- protected ListIterable<XmlMappingFileRef> getXmlMappingFileRefs() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlMappingFileRef>(this.xmlPersistenceUnit.getMappingFiles());
- }
-
- protected ContextListContainer<MappingFileRef, XmlMappingFileRef> buildSpecifiedMappingFileRefContainer() {
- return new SpecifiedMappingFileRefContainer();
- }
-
- /**
- * specified mapping file ref container
- */
- protected class SpecifiedMappingFileRefContainer
- extends ContextListContainer<MappingFileRef, XmlMappingFileRef>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_MAPPING_FILE_REFS_LIST;
- }
- @Override
- protected MappingFileRef buildContextElement(XmlMappingFileRef resourceElement) {
- return AbstractPersistenceUnit.this.buildSpecifiedMappingFileRef(resourceElement);
- }
- @Override
- protected ListIterable<XmlMappingFileRef> getResourceElements() {
- return AbstractPersistenceUnit.this.getXmlMappingFileRefs();
- }
- @Override
- protected XmlMappingFileRef getResourceElement(MappingFileRef contextElement) {
- return contextElement.getXmlMappingFileRef();
- }
- }
-
-
- // ********** implied mapping file ref **********
-
- public MappingFileRef getImpliedMappingFileRef() {
- return this.impliedMappingFileRef;
- }
-
- protected MappingFileRef addImpliedMappingFileRef() {
- if (this.impliedMappingFileRef != null) {
- throw new IllegalStateException("The implied mapping file ref is already set: " + this.impliedMappingFileRef); //$NON-NLS-1$
- }
- this.impliedMappingFileRef = this.buildImpliedMappingFileRef();
- this.firePropertyChanged(IMPLIED_MAPPING_FILE_REF_PROPERTY, null, this.impliedMappingFileRef);
- return this.impliedMappingFileRef;
- }
-
- protected MappingFileRef buildImpliedMappingFileRef() {
- return this.getContextNodeFactory().buildImpliedMappingFileRef(this);
- }
-
- protected void removeImpliedMappingFileRef() {
- if (this.impliedMappingFileRef == null) {
- throw new IllegalStateException("The implied mapping file ref is already unset."); //$NON-NLS-1$
- }
- MappingFileRef old = this.impliedMappingFileRef;
- this.impliedMappingFileRef = null;
- old.dispose();
- this.firePropertyChanged(IMPLIED_MAPPING_FILE_REF_PROPERTY, old, null);
- }
-
- protected void syncImpliedMappingFileRef() {
- if (this.impliedMappingFileRef != null) {
- this.impliedMappingFileRef.synchronizeWithResourceModel();
- }
- }
-
- protected void updateImpliedMappingFileRef() {
- if (this.buildsImpliedMappingFile()) {
- if (this.impliedMappingFileRef == null) {
- this.addImpliedMappingFileRef();
- } else {
- this.impliedMappingFileRef.update();
- }
- } else {
- if (this.impliedMappingFileRef != null) {
- this.removeImpliedMappingFileRef();
- }
- }
- }
-
- protected boolean buildsImpliedMappingFile() {
- return this.impliedMappingFileIsNotSpecified() && this.impliedMappingFileExists();
- }
-
- protected boolean impliedMappingFileIsNotSpecified() {
- return ! this.impliedMappingFileIsSpecified();
- }
-
- protected boolean impliedMappingFileIsSpecified() {
- return this.mappingFileIsSpecified(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
- }
-
- protected boolean mappingFileIsSpecified(String impliedMappingFileName) {
- for (MappingFileRef specifiedMappingFileRef : this.getSpecifiedMappingFileRefs()) {
- if (Tools.valuesAreEqual(specifiedMappingFileRef.getFileName(), impliedMappingFileName)) {
- return true;
- }
- }
- return false;
- }
-
- protected boolean impliedMappingFileExists() {
- return this.getJpaProject().getDefaultOrmXmlResource() != null;
- }
-
-
- // ********** JAR file refs **********
-
- public ListIterable<JarFileRef> getJarFileRefs() {
- return this.jarFileRefContainer.getContextElements();
- }
-
- public int getJarFileRefsSize() {
- return this.jarFileRefContainer.getContextElementsSize();
- }
-
- protected Iterable<String> getJarFileNames() {
- return new TransformationIterable<JarFileRef, String>(this.getJarFileRefs()) {
- @Override
- protected String transform(JarFileRef jarFileRef) {
- return jarFileRef.getFileName();
- }
- };
- }
-
- public JarFileRef addJarFileRef(String fileName) {
- return this.addJarFileRef(this.getJarFileRefsSize(), fileName);
- }
-
- public JarFileRef addJarFileRef(int index, String fileName) {
- XmlJarFileRef xmlJarFileRef = this.buildXmlJarFileRef(fileName);
- JarFileRef jarFileRef = this.jarFileRefContainer.addContextElement(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.jarFileRefContainer.indexOfContextElement(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.jarFileRefContainer.removeContextElement(index).dispose();
- }
-
- protected void syncJarFileRefs() {
- this.jarFileRefContainer.synchronizeWithResourceModel();
- }
-
- protected void updateJarFileRefs() {
- this.jarFileRefContainer.update();
- }
-
- protected ListIterable<XmlJarFileRef> getXmlJarFileRefs() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlJarFileRef>(this.xmlPersistenceUnit.getJarFiles());
- }
-
- protected ContextListContainer<JarFileRef, XmlJarFileRef> buildJarFileRefContainer() {
- return new JarFileRefContainer();
- }
-
- /**
- * JAR file ref container
- */
- protected class JarFileRefContainer
- extends ContextListContainer<JarFileRef, XmlJarFileRef>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return JAR_FILE_REFS_LIST;
- }
- @Override
- protected JarFileRef buildContextElement(XmlJarFileRef resourceElement) {
- return AbstractPersistenceUnit.this.buildJarFileRef(resourceElement);
- }
- @Override
- protected ListIterable<XmlJarFileRef> getResourceElements() {
- return AbstractPersistenceUnit.this.getXmlJarFileRefs();
- }
- @Override
- protected XmlJarFileRef getResourceElement(JarFileRef contextElement) {
- return contextElement.getXmlJarFileRef();
- }
- }
-
- // ********** class refs **********
-
- @SuppressWarnings("unchecked")
- public Iterable<ClassRef> getClassRefs() {
- return new CompositeIterable<ClassRef>(
- this.getSpecifiedClassRefs(),
- this.getImpliedClassRefs()
- );
- }
-
- public int getClassRefsSize() {
- return this.getSpecifiedClassRefsSize() + this.getImpliedClassRefsSize();
- }
-
- /**
- * Return the class ref names, both specified and implied.
- */
- protected Iterable<String> getClassRefNames() {
- return new TransformationIterable<ClassRef, String>(this.getClassRefs()) {
- @Override
- protected String transform(ClassRef classRef) {
- return classRef.getClassName();
- }
- };
- }
-
-
- // ********** specified class refs **********
-
- public ListIterable<ClassRef> getSpecifiedClassRefs() {
- return this.specifiedClassRefContainer.getContextElements();
- }
-
- public int getSpecifiedClassRefsSize() {
- return this.specifiedClassRefContainer.getContextElementsSize();
- }
-
- public ClassRef addSpecifiedClassRef(String className) {
- return this.addSpecifiedClassRef(this.getSpecifiedClassRefsSize(), className);
- }
-
- public ClassRef addSpecifiedClassRef(int index, String className) {
- XmlJavaClassRef xmlClassRef = this.buildXmlJavaClassRef(className);
- ClassRef classRef = this.specifiedClassRefContainer.addContextElement(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.specifiedClassRefContainer.indexOfContextElement(classRef));
- }
-
- public void removeSpecifiedClassRef(int index) {
- this.removeSpecifiedClassRef_(index);
- this.xmlPersistenceUnit.getClasses().remove(index);
- }
-
- /**
- * dispose the class ref
- */
- protected void removeSpecifiedClassRef_(int index) {
- this.specifiedClassRefContainer.removeContextElement(index).dispose();
- }
-
- protected void syncSpecifiedClassRefs() {
- this.specifiedClassRefContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedClassRefs() {
- this.specifiedClassRefContainer.update();
- }
-
- protected ListIterable<XmlJavaClassRef> getXmlClassRefs() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlJavaClassRef>(this.xmlPersistenceUnit.getClasses());
- }
-
- protected ContextListContainer<ClassRef, XmlJavaClassRef> buildSpecifiedClassRefContainer() {
- return new SpecifiedClassRefContainer();
- }
-
- /**
- * specified class ref container
- */
- protected class SpecifiedClassRefContainer
- extends ContextListContainer<ClassRef, XmlJavaClassRef>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_CLASS_REFS_LIST;
- }
- @Override
- protected ClassRef buildContextElement(XmlJavaClassRef resourceElement) {
- return AbstractPersistenceUnit.this.buildClassRef(resourceElement);
- }
- @Override
- protected ListIterable<XmlJavaClassRef> getResourceElements() {
- return AbstractPersistenceUnit.this.getXmlClassRefs();
- }
- @Override
- protected XmlJavaClassRef getResourceElement(ClassRef contextElement) {
- return contextElement.getXmlClassRef();
- }
- }
-
-
- // ********** virtual class refs **********
-
- public Iterable<ClassRef> getImpliedClassRefs() {
- return this.impliedClassRefContainer.getContextElements();
- }
-
- public int getImpliedClassRefsSize() {
- return this.impliedClassRefContainer.getContextElementsSize();
- }
-
- protected ClassRef addImpliedClassRef(String className) {
- return this.impliedClassRefContainer.addContextElement(getImpliedClassRefsSize(), className);
- }
-
- protected ClassRef buildClassRef(String className) {
- return this.getContextNodeFactory().buildClassRef(this, className);
- }
-
- protected void updateImpliedClassRefs() {
- this.impliedClassRefContainer.update();
- }
-
- 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);
- }
- };
- }
-
- protected ContextCollectionContainer<ClassRef, String> buildImpliedClassRefContainer() {
- return new ImpliedClassRefContainer();
- }
-
- /**
- * 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 ImpliedClassRefContainer
- extends ContextCollectionContainer<ClassRef, String>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return IMPLIED_CLASS_REFS_COLLECTION;
- }
- @Override
- protected ClassRef buildContextElement(String resourceElement) {
- return AbstractPersistenceUnit.this.buildClassRef(resourceElement);
- }
- @Override
- protected Iterable<String> getResourceElements() {
- return AbstractPersistenceUnit.this.getImpliedClassNames();
- }
- @Override
- protected String getResourceElement(ClassRef contextElement) {
- return contextElement.getClassName();
- }
- @Override
- public void removeContextElement(ClassRef element) {
- super.removeContextElement(element);
- element.dispose();
- }
- }
-
-
- // ********** 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 ListIterable<Property> getProperties() {
- return this.propertyContainer.getContextElements();
- }
-
- public int getPropertiesSize() {
- return this.propertyContainer.getContextElementsSize();
- }
-
- 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 Iterable<Property> getPropertiesWithNamePrefix(final String propertyNamePrefix) {
- if (propertyNamePrefix == null) {
- throw new NullPointerException();
- }
- return new FilteringIterable<Property>(this.getProperties()) {
- @Override
- protected boolean accept(Property property) {
- String pName = property.getName();
- return (pName != null) && pName.startsWith(propertyNamePrefix);
- }
- };
- }
-
- public Property addProperty() {
- return this.addProperty(this.getPropertiesSize());
- }
-
- 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.propertyContainer.indexOfContextElement(property));
- }
-
- public void removeProperty(String propertyName) {
- if (propertyName == null) {
- throw new NullPointerException();
- }
- for (Property property : this.getProperties()) {
- if (propertyName.equals(property.getName())) {
- this.removeProperty(property);
- 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 (Property property : this.getProperties()) {
- if (propertyName.equals(property.getName()) && value.equals(property.getValue())) {
- this.removeProperty(property);
- 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.propertyContainer.removeContextElement(index);
- this.xmlPersistenceUnit.getProperties().getProperties().remove(index);
-
- if (this.xmlPersistenceUnit.getProperties().getProperties().isEmpty()) {
- this.xmlPersistenceUnit.setProperties(null);
- }
-
- 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() {
- this.connection = this.getContextNodeFactory().buildConnection(this);
- this.options = this.getContextNodeFactory().buildOptions(this);
- }
-
- protected void syncProperties() {
- this.propertyContainer.synchronizeWithResourceModel();
- }
-
- protected void updateProperties() {
- this.propertyContainer.update();
- }
-
- protected ListIterable<XmlProperty> getXmlProperties() {
- XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties();
- // clone to reduce chance of concurrency problems
- return (xmlProperties == null) ?
- EmptyListIterable.<XmlProperty>instance() :
- new LiveCloneListIterable<XmlProperty>(xmlProperties.getProperties());
- }
-
- protected Property addProperty_(int index, XmlProperty xmlProperty) {
- Property property = this.propertyContainer.addContextElement(index, xmlProperty);
- if (property.getName() != null) {
- this.propertyAdded(property.getName(), property.getValue());
- }
- return property;
- }
-
- protected void removeProperty_(Property property) {
- this.propertyContainer.removeContextElement(property);
- if (property.getName() != null) {
- this.propertyRemoved(property.getName());
- }
- }
-
- protected ContextListContainer<Property, XmlProperty> buildPropertyContainer() {
- return new PropertyContainer();
- }
-
- /**
- * property container
- */
- protected class PropertyContainer
- extends ContextListContainer<Property, XmlProperty>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return PROPERTIES_LIST;
- }
- @Override
- protected Property buildContextElement(XmlProperty resourceElement) {
- return AbstractPersistenceUnit.this.buildProperty(resourceElement);
- }
- @Override
- protected ListIterable<XmlProperty> getResourceElements() {
- return AbstractPersistenceUnit.this.getXmlProperties();
- }
- @Override
- protected XmlProperty getResourceElement(Property contextElement) {
- return contextElement.getXmlProperty();
- }
- }
-
- // ********** 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 Iterable<Generator> getGenerators() {
- return new LiveCloneIterable<Generator>(this.generators);
- }
-
- public int getGeneratorsSize() {
- return this.generators.size();
- }
-
- public Iterable<String> getUniqueGeneratorNames() {
- HashSet<String> names = new HashSet<String>(this.generators.size());
- this.addNonEmptyGeneratorNamesTo(names);
- return names;
- }
-
- protected void addNonEmptyGeneratorNamesTo(Set<String> names) {
- for (Generator generator : this.getGenerators()) {
- String generatorName = generator.getName();
- if (StringTools.stringIsNotEmpty(generatorName)) {
- names.add(generatorName);
- }
- }
- }
-
- protected void setGenerators(Iterable<Generator> generators) {
- this.synchronizeCollection(generators, this.generators, GENERATORS_COLLECTION);
- }
-
- /**
- * We only hold "active" generators; i.e. the mapping file generators and
- * the Java generators that are not "overridden" by mapping file
- * generators (by generator name).
- */
- protected Iterable<Generator> buildGenerators() {
- ArrayList<Generator> generatorList = new ArrayList<Generator>();
-
- this.addMappingFileGeneratorsTo(generatorList);
-
- HashMap<String, ArrayList<Generator>> mappingFileGenerators = this.mapGeneratorsByName(this.getMappingFileGenerators());
- HashMap<String, ArrayList<Generator>> javaGenerators = this.mapGeneratorsByName(this.getJavaGenerators());
- for (Map.Entry<String, ArrayList<Generator>> javaGeneratorEntry : javaGenerators.entrySet()) {
- if (mappingFileGenerators.get(javaGeneratorEntry.getKey()) == null) {
- generatorList.addAll(javaGeneratorEntry.getValue());
- }
- }
-
- return generatorList;
- }
-
- protected Iterable<Generator> getMappingFileGenerators() {
- ArrayList<Generator> generatorList = new ArrayList<Generator>();
- this.addMappingFileGeneratorsTo(generatorList);
- return generatorList;
- }
-
- protected void addMappingFileGeneratorsTo(ArrayList<Generator> generatorList) {
- for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
- MappingFile mappingFile = mappingFileRef.getMappingFile();
- // TODO bjv - bogus cast - need to add API to MappingFileRef?
- if (mappingFile instanceof OrmXml) {
- EntityMappings entityMappings = ((OrmXml) mappingFile).getRoot();
- if (entityMappings != null) {
- CollectionTools.addAll(generatorList, entityMappings.getSequenceGenerators());
- CollectionTools.addAll(generatorList, entityMappings.getTableGenerators());
- }
- }
- }
- this.addGeneratorsTo(this.getMappingFilePersistentTypes(), generatorList);
- }
-
- /**
- * Include "overridden" Java generators.
- */
- protected Iterable<Generator> getJavaGenerators() {
- ArrayList<Generator> generatorList = new ArrayList<Generator>();
- this.addJavaGeneratorsTo(generatorList);
- return generatorList;
- }
-
- /**
- * Include "overridden" Java generators.
- */
- protected void addJavaGeneratorsTo(ArrayList<Generator> generatorList) {
- this.addGeneratorsTo(this.getAllJavaPersistentTypesUnique(), generatorList);
- }
-
- // TODO bjv - bogus casts - need to delegate...
- protected void addGeneratorsTo(Iterable<PersistentType> persistentTypes, ArrayList<Generator> generatorList) {
- for (PersistentType persistentType : persistentTypes) {
- TypeMapping typeMapping = persistentType.getMapping();
- if (typeMapping instanceof Entity) {
- this.addGeneratorsTo(((Entity) typeMapping).getGeneratorContainer(), generatorList);
- }
- for (ReadOnlyPersistentAttribute persistentAttribute : persistentType.getAttributes()) {
- AttributeMapping attributeMapping = persistentAttribute.getMapping();
- if (attributeMapping instanceof IdMapping) {
- this.addGeneratorsTo(((IdMapping) attributeMapping).getGeneratorContainer(), generatorList);
- }
- }
- }
- }
-
- protected void addGeneratorsTo(GeneratorContainer generatorContainer, ArrayList<Generator> generatorList) {
- Generator generator = generatorContainer.getSequenceGenerator();
- if (generator != null) {
- generatorList.add(generator);
- }
- generator = generatorContainer.getTableGenerator();
- if (generator != null) {
- generatorList.add(generator);
- }
- }
-
- protected HashMap<String, ArrayList<Generator>> mapGeneratorsByName(Iterable<Generator> generatorList) {
- HashMap<String, ArrayList<Generator>> map = new HashMap<String, ArrayList<Generator>>();
- for (Generator generator : generatorList) {
- String generatorName = generator.getName();
- ArrayList<Generator> list = map.get(generatorName);
- if (list == null) {
- list = new ArrayList<Generator>();
- map.put(generatorName, list);
- }
- list.add(generator);
- }
- return map;
- }
-
-
- // ********** queries **********
-
- public Iterable<Query> getQueries() {
- return new LiveCloneIterable<Query>(this.queries);
- }
-
- public int getQueriesSize() {
- return this.queries.size();
- }
-
- public void addQuery(Query query) {
- this.queries.add(query);
- }
-
- protected void setQueries(Iterable<Query> queries) {
- this.synchronizeCollection(queries, this.queries, QUERIES_COLLECTION);
- }
-
- /**
- * We only hold "active" queries; i.e. the mapping file queries and
- * the Java queries that are not "overridden" by mapping file
- * queries (by query name).
- */
- protected Iterable<Query> buildQueries() {
- ArrayList<Query> queryList = new ArrayList<Query>();
-
- this.addMappingFileQueriesTo(queryList);
-
- HashMap<String, ArrayList<Query>> mappingFileQueries = this.mapQueriesByName(this.getMappingFileQueries());
- HashMap<String, ArrayList<Query>> javaQueries = this.mapQueriesByName(this.getJavaQueries());
- for (Map.Entry<String, ArrayList<Query>> javaQueryEntry : javaQueries.entrySet()) {
- if (mappingFileQueries.get(javaQueryEntry.getKey()) == null) {
- queryList.addAll(javaQueryEntry.getValue());
- }
- }
-
- return queryList;
- }
-
- protected Iterable<Query> getMappingFileQueries() {
- ArrayList<Query> queryList = new ArrayList<Query>();
- this.addMappingFileQueriesTo(queryList);
- return queryList;
- }
-
- protected void addMappingFileQueriesTo(ArrayList<Query> queryList) {
- for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
- MappingFile mappingFile = mappingFileRef.getMappingFile();
- // TODO bjv - bogus cast - need to add API to MappingFileRef?
- if (mappingFile instanceof OrmXml) {
- EntityMappings entityMappings = ((OrmXml) mappingFile).getRoot();
- if (entityMappings != null) {
- this.addQueriesTo(entityMappings.getQueryContainer(), queryList);
- }
- }
- }
- this.addMappingFileQueriesTo(this.getMappingFilePersistentTypes(), queryList);
- }
-
- // TODO bjv - bogus casts - need to delegate...
- protected void addMappingFileQueriesTo(Iterable<PersistentType> persistentTypes, ArrayList<Query> queryList) {
- for (PersistentType persistentType : persistentTypes) {
- TypeMapping typeMapping = persistentType.getMapping();
- if (typeMapping instanceof Entity) {
- this.addQueriesTo(((Entity) typeMapping).getQueryContainer(), queryList);
- }
- // spec does not allow queries to be defined on mapped superclasses in orm.xml (huh?)
- }
- }
-
- /**
- * Include "overridden" Java queries.
- */
- protected Iterable<Query> getJavaQueries() {
- ArrayList<Query> queryList = new ArrayList<Query>();
- this.addJavaQueriesTo(queryList);
- return queryList;
- }
-
- /**
- * Include "overridden" Java queries.
- */
- protected void addJavaQueriesTo(ArrayList<Query> queryList) {
- this.addJavaQueriesTo(this.getAllJavaPersistentTypesUnique(), queryList);
- }
-
- // TODO bjv - bogus casts - need to delegate...
- protected void addJavaQueriesTo(Iterable<PersistentType> persistentTypes, ArrayList<Query> queryList) {
- for (PersistentType persistentType : persistentTypes) {
- TypeMapping typeMapping = persistentType.getMapping();
- if (typeMapping instanceof Entity) {
- this.addQueriesTo(((Entity) typeMapping).getQueryContainer(), queryList);
- }
-// TODO not yet supported by Dali
-// else if (typeMapping instanceof MappedSuperclass) {
-// this.addQueriesTo(((MappedSuperclass) typeMapping).getQueryContainer(), queryList);
-// }
- }
- }
-
- protected void addQueriesTo(QueryContainer queryContainer, ArrayList<Query> queryList) {
- CollectionTools.addAll(queryList, queryContainer.getNamedQueries());
- CollectionTools.addAll(queryList, queryContainer.getNamedNativeQueries());
- }
-
- protected HashMap<String, ArrayList<Query>> mapQueriesByName(Iterable<Query> queryList) {
- HashMap<String, ArrayList<Query>> map = new HashMap<String, ArrayList<Query>>();
- for (Query query : queryList) {
- String queryName = query.getName();
- ArrayList<Query> list = map.get(queryName);
- if (list == null) {
- list = new ArrayList<Query>();
- map.put(queryName, list);
- }
- list.add(query);
- }
- return map;
- }
-
-
- // ********** persistent types **********
-
- @SuppressWarnings("unchecked")
- public Iterable<PersistentType> getPersistentTypes() {
- return new CompositeIterable<PersistentType>(
- this.getMappingFilePersistentTypes(),
- this.getJavaPersistentTypes()
- );
- }
-
- 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
- );
- }
-
- /**
- * Return the non-<code>null</code> mapping file Java persistent types;
- * i.e. the Java persistent types corresponding to the mapping file
- * persistent types that are not marked "metadata complete".
- * @see #getAllJavaPersistentTypesUnique()
- */
- protected Iterable<PersistentType> getMappingFileJavaPersistentTypes() {
- return new FilteringIterable<PersistentType>(
- this.getMappingFileJavaPersistentTypes_(),
- NotNullFilter.<PersistentType>instance()
- );
- }
-
- /**
- * The returned list will contain a <code>null</code> for each mapping file
- * persistent type that does not correspond to an existing Java type or is
- * marked "metadata complete".
- * @see #getMappingFileJavaPersistentTypes()
- */
- // TODO bjv remove - bogus cast to OrmPersistentType - probably need to add API to MappingFile
- // getOverriddenPersistentTypes()?
- protected Iterable<PersistentType> getMappingFileJavaPersistentTypes_() {
- return new TransformationIterable<PersistentType, PersistentType>(this.getMappingFilePersistentTypes()) {
- @Override
- protected PersistentType transform(PersistentType mappingFilePersistentType) {
- return (mappingFilePersistentType instanceof OrmPersistentType) ?
- this.transform((OrmPersistentType) mappingFilePersistentType) :
- null;
- }
- protected PersistentType transform(OrmPersistentType mappingFilePersistentType) {
- return mappingFilePersistentType.getMapping().isMetadataComplete() ?
- null :
- mappingFilePersistentType.getJavaPersistentType();
- }
- };
- }
-
- /**
- * Return the persistence unit's Java persistent types, as specified by
- * the class refs (both specified and implied) and jar files.
- * There can be duplicate types, and any of them may be overridden by a
- * mapping file persistence type.
- * @see #getMappingFilePersistentTypes()
- */
- @SuppressWarnings("unchecked")
- protected Iterable<PersistentType> getJavaPersistentTypes() {
- return new CompositeIterable<PersistentType>(
- this.getClassRefPersistentTypes(),
- this.getJarFilePersistentTypes()
- );
- }
-
- /**
- * Return the non-<code>null</code> class ref persistent types,
- * both specified and implied.
- */
- protected Iterable<PersistentType> getClassRefPersistentTypes() {
- return new FilteringIterable<PersistentType>(
- this.getClassRefPersistentTypes_(),
- NotNullFilter.<PersistentType>instance()
- );
- }
-
- /**
- * Both specified and implied. May contain <code>null</code>s.
- * @see #getClassRefPersistentTypes()
- */
- protected Iterable<PersistentType> getClassRefPersistentTypes_() {
- return new TransformationIterable<ClassRef, PersistentType>(this.getClassRefs()) {
- @Override
- protected PersistentType transform(ClassRef classRef) {
- return classRef.getJavaPersistentType();
- }
- };
- }
-
- /**
- * We only get <em>annotated</em> types from jar files.
- */
- protected Iterable<PersistentType> getJarFilePersistentTypes() {
- return new CompositeIterable<PersistentType>(this.getJarFilePersistentTypeLists());
- }
-
- /**
- * We only get <em>annotated</em> types from jar files.
- */
- 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;
- }
- // search order is significant(?)
- 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;
- }
-
- /**
- * Ignore implied class refs and jar files.
- */
- public boolean specifiesPersistentType(String typeName) {
- for (ClassRef classRef : this.getSpecifiedClassRefs()) {
- if (classRef.isFor(typeName)) {
- return true;
- }
- }
- for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
- if (mappingFileRef.getPersistentType(typeName) != null) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Return a list of <em>all</em> the persistence unit's Java persistent
- * types (including those referenced by the mapping files that are not
- * marked "metadata complete") with those with duplicate names removed.
- * Although this may not always be true, assume persistent types with
- * the same name reference the same Java type. (<strong>NB:</strong>
- * It's possible that a Java class in a jar file has the same name as a
- * Java class in the project and they be different....)
- * <p>
- * This is really only useful for the calculation of generators and queries,
- * which can be defined in Java annotations but still be "active" even
- * though their corresponding Java types/attributes have been overridden in
- * a mapping file.
- * <p>
- * The order of precedence:<ul>
- * <li>mapping files
- * <li>persistence unit class refs
- * <li>jar files
- * </ul>
- */
- protected Iterable<PersistentType> getAllJavaPersistentTypesUnique() {
- // order is significant(?)
- HashMap<String, PersistentType> map = new HashMap<String, PersistentType>();
- this.addPersistentTypesTo(this.getJarFilePersistentTypes(), map);
- this.addPersistentTypesTo(this.getClassRefPersistentTypes(), map);
- this.addPersistentTypesTo(this.getMappingFileJavaPersistentTypes(), map);
- return map.values();
- }
-
- /**
- * Add the specified persistent types to
- * the specified map keyed by persistent type name.
- */
- protected void addPersistentTypesTo(Iterable<? extends PersistentType> persistentTypes, HashMap<String, PersistentType> persistentTypeMap) {
- for (PersistentType pt : persistentTypes) {
- String ptName = pt.getName();
- if (ptName != null) {
- persistentTypeMap.put(ptName, pt);
- }
- }
- }
-
-
- // ********** type mappings **********
-
- 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;
- }
-
- // TODO bjv - this should probably *not* return Java type mappings when PU is "metadata complete"...
- protected TypeMapping getTypeMapping(String typeName) {
- PersistentType persistentType = this.getPersistentType(typeName);
- return (persistentType == null) ? null : persistentType.getMapping();
- }
-
- public Iterable<Entity> getEntities() {
- return this.filterToEntities(this.getTypeMappings());
- }
-
- protected Iterable<Entity> filterToEntities(Iterable<TypeMapping> typeMappings) {
- return new SubIterableWrapper<TypeMapping, Entity>(this.filterToEntities_(typeMappings));
- }
-
- protected Iterable<TypeMapping> filterToEntities_(Iterable<TypeMapping> typeMappings) {
- return new FilteringIterable<TypeMapping>(typeMappings) {
- @Override
- protected boolean accept(TypeMapping typeMapping) {
- return typeMapping instanceof Entity;
- }
- };
- }
-
- // TODO bjv - this should probably *not* return Java type mappings when PU is "metadata complete"...
- 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
- }
- };
- }
-
- /**
- * Filters out the entities from the active type mappings
- */
- protected Iterable<Entity> getActiveEntities() {
- return filterToEntities(this.getActiveTypeMappings());
- }
-
- /**
- * Returns the "active" type mappings, i.e. the mapping file type mappings and
- * the Java type mappings that are not "overridden" by mapping file
- * type mappings (by full qualified class name).
- */
- protected Iterable<TypeMapping> getActiveTypeMappings(){
- ArrayList<TypeMapping> typeMappingList = new ArrayList<TypeMapping>();
- CollectionTools.addAll(typeMappingList, this.getMappingFileTypeMappings());
-
- HashMap<String, ArrayList<TypeMapping>> mappingFileTypeMappings = this.mapTypeMappingsByClassName(this.getMappingFileTypeMappings());
- HashMap<String, ArrayList<TypeMapping>> javaTypeMappings = this.mapTypeMappingsByClassName(this.getJavaTypeMappings());
- for (Map.Entry<String, ArrayList<TypeMapping>> javaTypeMappingEntry : javaTypeMappings.entrySet()) {
- if (mappingFileTypeMappings.get(javaTypeMappingEntry.getKey()) == null) {
- typeMappingList.addAll(javaTypeMappingEntry.getValue());
- }
- }
-
- return typeMappingList;
- }
-
- /**
- * Return a map of the type mappings keyed by type mapping name (short class name).
- * Since there can be duplicate (erroneously) type mapping names,
- * each type mapping name is mapped to a <em>list</em> of type mappings.
- */
- protected <M extends TypeMapping> HashMap<String, ArrayList<M>> mapTypeMappingsByName(Iterable<M> typeMappings) {
- HashMap<String, ArrayList<M>> map = new HashMap<String, ArrayList<M>>();
- for (M typeMapping : typeMappings) {
- String typeMappingName = typeMapping.getName();
- ArrayList<M> list = map.get(typeMappingName);
- if (list == null) {
- list = new ArrayList<M>();
- map.put(typeMappingName, list);
- }
- list.add(typeMapping);
- }
- return map;
- }
-
- /**
- * Return a map of the type mappings keyed by full qualified class name.
- * Since there can be duplicate (erroneously) class names,
- * each class name is mapped to a <em>list</em> of type mappings.
- */
- protected <M extends TypeMapping> HashMap<String, ArrayList<M>> mapTypeMappingsByClassName(Iterable<M> typeMappings) {
- HashMap<String, ArrayList<M>> map = new HashMap<String, ArrayList<M>>();
- for (M typeMapping : typeMappings) {
- String typeMappingName = typeMapping.getPersistentType().getName();
- ArrayList<M> list = map.get(typeMappingName);
- if (list == null) {
- list = new ArrayList<M>();
- map.put(typeMappingName, list);
- }
- list.add(typeMapping);
- }
- return map;
- }
-
- // ********** mapping file type mappings **********
-
- /**
- * Return all the entities defined in the persistence unit's mapping files
- * (i.e. excluding the Java entities).
- */
- protected Iterable<Entity> getMappingFileEntities() {
- return this.filterToEntities(this.getMappingFileTypeMappings());
- }
-
- /**
- * Return all the type mappings defined in the persistence unit's mapping
- * files (i.e. excluding the Java type mappings).
- */
- protected Iterable<TypeMapping> getMappingFileTypeMappings() {
- return new TransformationIterable<PersistentType, TypeMapping>(this.getMappingFilePersistentTypes()) {
- @Override
- protected TypeMapping transform(PersistentType persistentType) {
- return persistentType.getMapping();
- }
- };
- }
-
- public Iterable<String> getMappingFileMappedClassNames() {
- return new TransformationIterable<PersistentType, String>(this.getMappingFilePersistentTypes()) {
- @Override
- protected String transform(PersistentType persistentType) {
- return persistentType.getName();
- }
- };
- }
-
- // ********** Java type mappings **********
-
- /**
- * These may be overridden in the mapping files.
- * @see #getJavaPersistentTypes()
- */
- public Iterable<Entity> getJavaEntities() {
- return this.filterToEntities(this.getJavaTypeMappings());
- }
-
- /**
- * These may be overridden in the mapping files.
- * @see #getJavaPersistentTypes()
- */
- protected Iterable<TypeMapping> getJavaTypeMappings() {
- return new TransformationIterable<PersistentType, TypeMapping>(this.getJavaPersistentTypes()) {
- @Override
- protected TypeMapping transform(PersistentType persistentType) {
- return persistentType.getMapping();
- }
- };
- }
-
- // ********** misc **********
-
- public XmlPersistenceUnit getXmlPersistenceUnit() {
- return this.xmlPersistenceUnit;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (JarFileRef jarFileRef : this.getJarFileRefs()) {
- if (jarFileRef.containsOffset(textOffset)) {
- return jarFileRef;
- }
- }
- for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) {
- if (mappingFileRef.containsOffset(textOffset)) {
- return mappingFileRef;
- }
- }
- for (ClassRef classRef : this.getClassRefs()) {
- if (classRef.containsOffset(textOffset)) {
- return classRef;
- }
- }
- return this;
- }
-
- 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);
- }
-
-
- // ********** 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);
- this.validateGenerators(messages, reporter);
- this.validateQueries(messages, reporter);
- this.validateEntityNames(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);
- }
- this.checkForDuplicateMappingFileClasses(messages);
- }
-
- protected void checkForMultiplePersistenceUnitMetadata(List<IMessage> messages) {
- Iterable<MappingFileRef> pumdMappingFileRefs = this.getPersistenceUnitMetadataMappingFileRefs();
- if (CollectionTools.size(pumdMappingFileRefs) > 1) {
- for (MappingFileRef mappingFileRef : pumdMappingFileRefs) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA,
- new String[] {mappingFileRef.getFileName()},
- mappingFileRef.getMappingFile(),
- mappingFileRef.getPersistenceUnitMetadata().getValidationTextRange()
- )
- );
- }
- }
- }
-
- protected Iterable<MappingFileRef> getPersistenceUnitMetadataMappingFileRefs() {
- return new FilteringIterable<MappingFileRef>(this.getMappingFileRefs()) {
- @Override
- protected boolean accept(MappingFileRef mappingFileRef) {
- return mappingFileRef.persistenceUnitMetadataExists();
- }
- };
- }
-
- protected void checkForDuplicateMappingFiles(List<IMessage> messages) {
- HashBag<String> fileNames = CollectionTools.bag(this.getMappingFileRefNames());
- 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 checkForDuplicateMappingFileClasses(List<IMessage> messages) {
- HashBag<String> classNames = CollectionTools.bag(this.getMappingFileMappedClassNames());
- for (PersistentType persistentType : this.getMappingFilePersistentTypes()) {
- String className = persistentType.getName();
- if ((className != null) && (!StringTools.stringIsEmpty(className))
- &&(classNames.count(className) > 1)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_DUPLICATE_CLASS,
- new String[] {className},
- persistentType,
- persistentType.getValidationTextRange()
- )
- );
- }
- }
- }
-
- protected void validateClassRefs(List<IMessage> messages, IReporter reporter) {
- this.checkForDuplicateClasses(messages);
- for (ClassRef classRef : this.getClassRefs()) {
- classRef.validate(messages, reporter);
- }
- }
-
- protected void checkForDuplicateClasses(List<IMessage> messages) {
- HashBag<String> javaClassNames = CollectionTools.bag(this.getClassRefNames());
- for (ClassRef classRef : this.getClassRefs()) {
- String javaClassName = classRef.getClassName();
- if ((javaClassName != null) && (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 jarFileRef : this.getJarFileRefs()) {
- jarFileRef.validate(messages, reporter);
- }
- }
-
- protected void checkForDuplicateJarFileRefs(List<IMessage> messages) {
- HashBag<String> jarFileNames = CollectionTools.bag(this.getJarFileNames());
- for (JarFileRef jarFileRef : this.getJarFileRefs()) {
- 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
- }
-
- /**
- * We validate generators here because Java persistent types that are
- * overridden in the <code>orm.xml</code> file are
- * not validated, but they may contain generators that are still "active"
- * and need to be validated
- * (i.e. a generator is <em>not</em> overridden when its entity or ID
- * mapping is overridden in the <code>orm.xml</code> file).
- * <p>
- * <strong>NB:</strong> <em>Any</em> <code>orm.xml</code> generator can
- * override <em>any</em> Java generator with the same name; they need not
- * be defined on the same entity or ID mapping. Just a bit inconsistent with
- * the typical "override" in JPA....
- */
- protected void validateGenerators(List<IMessage> messages, IReporter reporter) {
- this.checkForDuplicateGenerators(messages);
- for (Generator generator : this.getGenerators()) {
- this.validate(generator, messages, reporter);
- }
- }
-
- protected void checkForDuplicateGenerators(List<IMessage> messages) {
- HashMap<String, ArrayList<Generator>> generatorsByName = this.mapGeneratorsByName(this.getGenerators());
- for (Map.Entry<String, ArrayList<Generator>> entry : generatorsByName.entrySet()) {
- String generatorName = entry.getKey();
- if (StringTools.stringIsNotEmpty(generatorName)) { // ignore empty names
- ArrayList<Generator> dups = entry.getValue();
- if (dups.size() > 1) {
- for (Generator dup : dups) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.GENERATOR_DUPLICATE_NAME,
- new String[] {generatorName},
- dup,
- this.extractNameTextRange(dup)
- )
- );
- }
- }
- }
- }
- }
-
- // TODO bjv isn't it obvious?
- protected TextRange extractNameTextRange(Generator generator) {
- return (generator instanceof OrmGenerator) ?
- ((OrmGenerator) generator).getNameTextRange() :
- ((JavaGenerator) generator).getNameTextRange(null);
- }
-
- // TODO bjv isn't it obvious?
- protected void validate(Generator generator, List<IMessage> messages, IReporter reporter) {
- if (generator instanceof OrmGenerator) {
- ((OrmGenerator) generator).validate(messages, reporter);
- } else {
- ((JavaGenerator) generator).validate(messages, reporter, null);
- }
- }
-
- /**
- * <strong>NB:</strong> We validate queries here.
- * @see #validateGenerators(List, IReporter)
- */
- protected void validateQueries(List<IMessage> messages, IReporter reporter) {
- this.checkForDuplicateQueries(messages);
- for (Query query : this.getQueries()) {
- this.validate(query, messages, reporter);
- }
- }
-
- protected void checkForDuplicateQueries(List<IMessage> messages) {
- HashMap<String, ArrayList<Query>> queriesByName = this.mapQueriesByName(this.getQueries());
- for (Map.Entry<String, ArrayList<Query>> entry : queriesByName.entrySet()) {
- String queryName = entry.getKey();
- if (StringTools.stringIsNotEmpty(queryName)) { // ignore empty names
- ArrayList<Query> dups = entry.getValue();
- if (dups.size() > 1) {
- for (Query dup : dups) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.QUERY_DUPLICATE_NAME,
- new String[] {queryName},
- dup,
- this.extractNameTextRange(dup)
- )
- );
- }
- }
- }
- }
- }
-
- // TODO bjv isn't it obvious?
- protected TextRange extractNameTextRange(Query query) {
- return (query instanceof OrmQuery) ?
- ((OrmQuery) query).getNameTextRange() :
- ((JavaQuery) query).getNameTextRange(null);
- }
-
- // TODO bjv isn't it obvious?
- protected void validate(Query query, List<IMessage> messages, IReporter reporter) {
- if (query instanceof OrmQuery) {
- ((OrmQuery) query).validate(messages, reporter);
- } else {
- ((JavaQuery) query).validate(messages, reporter, null);
- }
- }
-
- protected void validateEntityNames(List<IMessage> messages, IReporter reporter) {
- this.checkforDuplicateEntityNames(messages);
- }
-
- protected void checkforDuplicateEntityNames(List<IMessage> messages) {
- HashMap<String, ArrayList<Entity>> activeEntityNames = this.mapTypeMappingsByName(this.getActiveEntities());
- for (ArrayList<Entity> dups : activeEntityNames.values()) {
- if (dups.size() > 1) {
- for (Entity dup : dups) {
- if (!StringTools.stringIsEmpty(dup.getName())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_NAME_DUPLICATED,
- new String[] {dup.getName()},
- dup,
- this.extractNameTextRange(dup)
- )
- );
- }
-
- }
- }
- }
- }
-
- protected TextRange extractNameTextRange(Entity entity) {
- return (entity instanceof OrmEntity) ?
- ((OrmEntity) entity).getXmlTypeMapping().getNameTextRange():
- ((JavaEntity) entity).getMappingAnnotation().getNameTextRange(null);
- }
-
- public boolean validatesAgainstDatabase() {
- return this.connectionProfileIsActive();
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlPersistenceUnit.getValidationTextRange();
- return (textRange != null) ? textRange : this.getPersistence().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);
- }
- }
- );
- }
-
-
- // ********** 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<JavaResourceAbstractType, IFile>(this.getGeneratedMetamodelTopLevelTypes()) {
- @Override
- protected IFile transform(JavaResourceAbstractType jrpt) {
- return jrpt.getFile();
- }
- };
- }
-
- protected Iterable<JavaResourceAbstractType> 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, PersistentType> allPersistentTypes = new HashMap<String, PersistentType>();
- this.addPersistentTypesTo(this.getJarFilePersistentTypes(), allPersistentTypes);
- this.addPersistentTypesTo(this.getClassRefPersistentTypes(), allPersistentTypes);
- this.addPersistentTypesTo(this.getMappingFilePersistentTypes(), 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 (PersistentType type1_0 : allPersistentTypes.values()) {
- PersistentType2_0 type = (PersistentType2_0) type1_0;
- 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 = (PersistentType2_0) allPersistentTypes.get(memberTypeName);
- if (memberType != null) {
- break; // stop - this will be processed in the outer 'for' loop
- }
- // check for a Java resource persistent type
- JavaResourceAbstractType jrat = this.getJpaProject().getJavaResourceType(memberTypeName);
- if (jrat != null) {
- declaringTypeName = jrat.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 MetamodelSourceType selectSourceType(Iterable<MetamodelSourceType> types, String typeName) {
- if (types != null) {
- for (MetamodelSourceType type : types) {
- if (type.getName().equals(typeName)) {
- return type;
- }
- }
- }
- return null;
- }
-
- protected MetamodelSourceType buildNonPersistentMetamodelSourceType(String nonPersistentTypeName) {
- return new NonPersistentMetamodelSourceType(nonPersistentTypeName, this.getJpaProject());
- }
-
- protected IType findJdtType(String typeName) {
- try {
- return this.getJpaProject().getJavaProject().findType(typeName);
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return null;
- }
- }
-
- protected void deleteMetamodelFile(IFile file) {
- try {
- this.deleteMetamodelFile_(file);
- } catch (CoreException ex) {
- JptJpaCorePlugin.log(ex);
- }
- }
-
- protected void deleteMetamodelFile_(IFile file) throws CoreException {
- if (this.fileIsGeneratedMetamodel(file)) {
- file.delete(true, null); // true = force
- }
- }
-
- protected boolean fileIsGeneratedMetamodel(IFile file) {
- return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTopLevelType(file) != null;
- }
-
- public void disposeMetamodel() {
- this.metamodelFiles.clear();
- }
-
-
- // ***** Metamodel source for non-persistent types
- protected static class NonPersistentMetamodelSourceType
- implements MetamodelSourceType
- {
- protected final String name;
- protected final JpaProject jpaProject;
- protected final MetamodelSourceType.Synchronizer metamodelSynchronizer;
-
- protected NonPersistentMetamodelSourceType(String name, JpaProject jpaProject) {
- super();
- this.name = name;
- this.jpaProject = jpaProject;
- this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
- }
-
- protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() {
- return this.getJpaFactory().buildMetamodelSynchronizer(this);
- }
-
- protected JpaFactory2_0 getJpaFactory() {
- return (JpaFactory2_0) this.getJpaProject().getJpaPlatform().getJpaFactory();
- }
-
- public String getName() {
- return this.name;
- }
-
- public boolean isManaged() {
- return false;
- }
-
- public PersistentType getSuperPersistentType() {
- return null;
- }
-
- public ListIterable<? extends ReadOnlyPersistentAttribute> getAttributes() {
- return EmptyListIterable.instance();
- }
-
- public IFile getMetamodelFile() {
- return this.metamodelSynchronizer.getFile();
- }
-
- public JpaProject getJpaProject() {
- return this.jpaProject;
- }
-
- public void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- this.metamodelSynchronizer.synchronize(memberTypeTree);
- }
-
- public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java
deleted file mode 100644
index 96edeee601..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.persistence;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.utility.internal.ReflectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.text.edits.ReplaceEdit;
-
-/**
- * AbstractPersistenceUnitProperties
- */
-public abstract class AbstractPersistenceUnitProperties extends AbstractModel
- implements PersistenceUnitProperties
-{
- private PersistenceUnit persistenceUnit;
-
- // key = PersistenceUnit property key; value = property id
- private Map<String, String> propertyNames;
-
- public static final String PROPERTY_VALUE_DELIMITER = ","; //$NON-NLS-1$
- private static final long serialVersionUID = 1L;
-
- // ********** constructors / initialization **********
- protected AbstractPersistenceUnitProperties(PersistenceUnit parent) {
- super();
- this.initialize();
- this.initialize(parent);
- this.postInitialize();
- }
-
- /**
- * Base initialization.
- */
- protected void initialize() {
- this.propertyNames = new HashMap<String, String>();
- }
-
- /**
- * Initialization based on the persistence unit.
- */
- protected void initialize(PersistenceUnit parent) {
- this.persistenceUnit = parent;
-
- this.initializePropertyNames();
- this.initializeProperties();
- }
-
- protected void initializePropertyNames() {
- this.addPropertyNames(this.propertyNames);
- }
-
- /**
- * Initializes properties with values from the persistence unit.
- */
- protected abstract void initializeProperties();
-
- /**
- * Does all post treatment in this method after the properties are initialized
- */
- protected void postInitialize() {
- // do nothing by default
- }
-
- // ********** behavior **********
- public PersistenceUnit getPersistenceUnit() {
- return this.persistenceUnit;
- }
-
- public JpaProject getJpaProject() {
- return this.persistenceUnit.getJpaProject();
- }
-
- /**
- * Adds property names key/value pairs, used by the methods: itemIsProperty
- * and propertyIdFor.
- *
- * key = property key; value = property id
- */
- protected abstract void addPropertyNames(Map<String, String> pNames);
-
- /**
- * Method used for identifying the given property.
- */
- public boolean itemIsProperty(PersistenceUnit.Property item) {
- if (item == null) {
- throw new NullPointerException();
- }
- return this.propertyNames().keySet().contains(item.getName());
- }
-
- /**
- * Returns the property name used for change notification of the given
- * property.
- */
- public String propertyIdOf(PersistenceUnit.Property property) {
- String propertyId = this.propertyNames().get(property.getName());
- if (propertyId == null) {
- throw new IllegalArgumentException("Illegal property: " + property); //$NON-NLS-1$
- }
- return propertyId;
- }
-
- public String propertyIdOf(String eclipseLinkkey) {
- String propertyId = this.propertyNames().get(eclipseLinkkey);
- if (propertyId == null) {
- throw new IllegalArgumentException("Illegal property: " + eclipseLinkkey); //$NON-NLS-1$
- }
- return propertyId;
- }
-
- /*
- * Get the PersistenceUnit property key of the given property
- */
- protected String persistenceUnitKeyOf(String propertyId) {
- for (String persistenceUnitKey : this.propertyNames().keySet()) {
- if (this.propertyNames().get(persistenceUnitKey).equals(propertyId)) {
- return persistenceUnitKey;
- }
- }
- throw new IllegalArgumentException("Illegal property ID: " + propertyId); //$NON-NLS-1$
- }
-
- // ******** Convenience methods ********
- /**
- * Put into persistenceUnit properties.
- *
- * @param key -
- * property name
- * @param value -
- * property value
- */
- protected void putProperty(String key, Object value) {
- this.putProperty(key, value, false);
- }
-
- @SuppressWarnings("unchecked")
- protected void putProperty(String key, Object value, boolean allowDuplicates) {
- String persistenceUnitKey = this.persistenceUnitKeyOf(key);
- if ((value != null) && value.getClass().isEnum()) {
- this.putEnumValue(persistenceUnitKey, (Enum) value, allowDuplicates);
- }
- else {
- this.putPersistenceUnitProperty(persistenceUnitKey, null, value, allowDuplicates);
- }
- }
-
- /**
- * Removes a persistenceUnit property.
- *
- * @param key -
- * property name
- * @param value -
- * property value
- */
- protected void removeProperty(String key, String value) {
- String persistenceUnitKey = this.persistenceUnitKeyOf(key);
-
- this.getPersistenceUnit().removeProperty(persistenceUnitKey, value);
- }
-
- /**
- * Returns true when the given key exits in the PersistenceXml.
- */
- protected boolean persistenceUnitKeyExists(String persistenceUnitKey) {
- return (this.getStringValue(persistenceUnitKey) != null);
- }
-
- // ****** get/set String convenience methods *******
- /**
- * Returns the String value of the given Property from the PersistenceXml.
- */
- protected String getStringValue(String persistenceUnitKey) {
- PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey);
- return (p == null) ? null : p.getValue();
- }
-
- protected String getStringValue(String key, String keySuffix) {
- return this.getStringValue((keySuffix == null) ? key : key + keySuffix);
- }
-
- /**
- * Put the given String value into the PersistenceXml.
- * @param key -
- * property key
- * @param newValue
- * value to be associated with the key
- */
- protected void putStringValue(String key, String newValue) {
- this.putStringValue(key, null, newValue, false);
- }
-
- /**
- * Put the given String value into the PersistenceXml.
- * @param key
- * property key
- * @param newValue
- * value to be associated with the key
- * @param allowDuplicate
- */
- protected void putStringValue(String key, String newValue, boolean allowDuplicate) {
- this.putStringValue(key, null, newValue, allowDuplicate);
- }
-
- /**
- * Put the given String value into the PersistenceXml.
- * @param key
- * property key
- * @param keySuffix
- * e.g. entity name
- * @param newValue
- * value to be associated with the key
- * @param allowDuplicate
- */
- protected void putStringValue(String key, String keySuffix, String newValue, boolean allowDuplicate) {
- this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate);
- }
-
- // ****** Integer convenience methods *******
- /**
- * Returns the Integer value of the given Property from the PersistenceXml.
- */
- protected Integer getIntegerValue(String persistenceUnitKey) {
- PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey);
- return (p == null) ? null : getIntegerValueOf(p.getValue());
- }
-
- protected Integer getIntegerValue(String key, String keySuffix) {
- return this.getIntegerValue((keySuffix == null) ? key : key + keySuffix);
- }
-
- /**
- * Put the given Integer value into the PersistenceXml.
- * @param key -
- * property key
- * @param newValue
- * value to be associated with the key
- */
- protected void putIntegerValue(String key, Integer newValue) {
- this.putIntegerValue(key, null, newValue, false);
- }
-
- /**
- * Put the given Integer value into the PersistenceXml.
- * @param key
- * property key
- * @param newValue
- * value to be associated with the key
- * @param allowDuplicate
- */
- protected void putIntegerValue(String key, Integer newValue, boolean allowDuplicate) {
- this.putIntegerValue(key, null, newValue, allowDuplicate);
- }
-
- /**
- * Put the given Integer value into the PersistenceXml.
- * @param key
- * property key
- * @param keySuffix
- * e.g. entity name
- * @param newValue
- * value to be associated with the key
- * @param allowDuplicate
- */
- protected void putIntegerValue(String key, String keySuffix, Integer newValue, boolean allowDuplicate) {
- this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate);
- }
-
- // ****** Boolean convenience methods *******
- /**
- * Returns the Boolean value of the given Property from the PersistenceXml.
- */
- protected Boolean getBooleanValue(String persistenceUnitKey) {
- PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey);
- return (p == null) ? null : getBooleanValueOf(p.getValue());
- }
-
- protected Boolean getBooleanValue(String key, String keySuffix) {
- return this.getBooleanValue((keySuffix == null) ? key : key + keySuffix);
- }
-
- /**
- * Put the given Boolean value into the PersistenceXml.
- * @param key
- * property key
- * @param newValue
- * value to be associated with the key
- */
- protected void putBooleanValue(String key, Boolean newValue) {
- this.putBooleanValue(key, null, newValue, false);
- }
-
- /**
- * Put the given Boolean value into the PersistenceXml.
- * @param key
- * property key
- * @param newValue
- * value to be associated with the key
- * @param allowDuplicate
- */
- protected void putBooleanValue(String key, Boolean newValue, boolean allowDuplicate) {
- this.putBooleanValue(key, null, newValue, allowDuplicate);
- }
-
- /**
- * Put the given Boolean value into the PersistenceXml.
- * @param key
- * property key
- * @param keySuffix
- * e.g. entity name
- * @param newValue
- * value to be associated with the key
- * @param allowDuplicate
- */
- protected void putBooleanValue(String key, String keySuffix, Boolean newValue, boolean allowDuplicate) {
- this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate);
- }
-
- // ****** Enum convenience methods *******
- /**
- * Returns the Enum value of the given Property from the PersistenceXml.
- */
- protected <T extends Enum<T>> T getEnumValue(String persistenceUnitKey, T[] enumValues) {
- PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey);
- return (p == null) ? null : getEnumValueOf(p.getValue(), enumValues);
- }
-
- protected <T extends Enum<T>> T getEnumValue(String key, String keySuffix, T[] enumValues) {
- return this.getEnumValue((keySuffix == null) ? key : key + keySuffix, enumValues);
- }
-
- /**
- * Put the given Enum value into the PersistenceXml.
- *
- * @param key -
- * property key
- */
- protected <T extends Enum<T>> void putEnumValue(String key, T newValue) {
- this.putEnumValue(key, null, newValue, false);
- }
-
- protected <T extends Enum<T>> void putEnumValue(String key, T newValue, boolean allowDuplicate) {
- this.putEnumValue(key, null, newValue, allowDuplicate);
- }
-
- protected <T extends Enum<T>> void putEnumValue(String key, String keySuffix, T newValue, boolean allowDuplicate) {
- this.putPersistenceUnitProperty(key, keySuffix, getPropertyStringValueOf(newValue), allowDuplicate);
- }
-
- // ****** get/set CompositeValue convenience methods *******
- /**
- * Returns the String values of the given Property from the PersistenceXml.
- */
- protected List<String> getCompositeValue(String persistenceUnitKey) {
- String values = this.getStringValue(persistenceUnitKey);
- return this.extractCompositeValue(values);
- }
-
- /**
- * Put into persistenceUnit properties. If the property already exists,
- * it appends the given value at the end of the property value.
- *
- * @param key
- * @param valueToAppend
- */
- protected void putPropertyCompositeValue(String key, String valueToAppend) {
- String persistenceUnitKey = this.persistenceUnitKeyOf(key);
-
- String persistenceUnitValue = this.buildCompositeValue(
- this.getStringValue(persistenceUnitKey), valueToAppend);
-
- this.putPersistenceUnitProperty(persistenceUnitKey, null, persistenceUnitValue, false);
- }
-
- /**
- * Removes a value from a property with composite values.
- * If the resulting value is empty, the property is removed from the persistenceUnit.
- *
- * @param key -
- * property name
- * @param valueToRemove -
- * value to remove from the property
- */
- protected void removePropertyCompositeValue(String key, String valueToRemove) {
- String persistenceUnitKey = this.persistenceUnitKeyOf(key);
-
- String persistenceUnitValue = this.removeValueFrom(
- this.getStringValue(persistenceUnitKey), valueToRemove.trim());
-
- this.putPersistenceUnitProperty(persistenceUnitKey, null, persistenceUnitValue, false);
- }
-
- // ****** Static methods *******
-
- public static Boolean getBooleanValueOf(String puStringValue) {
- if (StringTools.stringIsEmpty(puStringValue)) {
- return null;
- }
- return Boolean.valueOf(puStringValue);
- }
-
- public static Integer getIntegerValueOf(String puStringValue) {
- if (StringTools.stringIsEmpty(puStringValue)) {
- return null;
- }
- try {
- return Integer.valueOf(puStringValue);
- }
- catch (NumberFormatException nfe) {
- return null;
- }
- }
-
- /**
- * Returns the enum constant of the specified enum type with the specified
- * Property string value.
- */
- public static <T extends Enum<T>> T getEnumValueOf(String puStringValue, T[] enumValues) {
- for (T enumValue : enumValues) {
- if (getPropertyStringValueOf(enumValue).equals(puStringValue)) {
- return enumValue;
- }
- }
- return null;
- }
-
- /**
- * Returns the Property string value of the given property value.
- */
- public static String getPropertyStringValueOf(Object value) {
- if (value == null) {
- return null;
- }
- if (value.getClass().isEnum()) {
- return (String) ReflectionTools.getStaticFieldValue(value.getClass(), value.toString().toUpperCase(Locale.ENGLISH));
- }
- return value.toString();
- }
-
- // ********** internal methods **********
-
- private Map<String, String> propertyNames() {
- return this.propertyNames;
- }
-
- private void putPersistenceUnitProperty(String key, String keySuffix, Object value, boolean allowDuplicates) {
- String persistenceUnitKey = (keySuffix == null) ? key : key + keySuffix;
- String stringValue = (value == null) ? null : value.toString();
- this.getPersistenceUnit().setProperty(persistenceUnitKey, stringValue, allowDuplicates);
- }
-
- private String buildCompositeValue(String value, String valueToAppend) {
- if((StringTools.stringIsEmpty(valueToAppend)) ) {
- return value;
- }
- return (StringTools.stringIsEmpty(value)) ?
- valueToAppend :
- (value + PROPERTY_VALUE_DELIMITER + valueToAppend);
- }
-
- protected List<String> extractCompositeValue(String compositeValue) {
- if(StringTools.stringIsEmpty(compositeValue)) {
- return new ArrayList<String>(0);
- }
- String[] values = compositeValue.split(PROPERTY_VALUE_DELIMITER);
- List<String> results = new ArrayList<String>(values.length);
- for(String value : values) {
- results.add(value.trim());
- }
- return results;
- }
-
- private String removeValueFrom(String compositeValue, String valueToRemove) {
- if((StringTools.stringIsEmpty(valueToRemove))) {
- return compositeValue;
- }
- String[] values = compositeValue.split(PROPERTY_VALUE_DELIMITER);
- ArrayList<String> results = new ArrayList<String>(values.length);
-
- for(String value : values) {
- if(value.trim().equals(valueToRemove)) {
- continue;
- }
- results.add(value);
- }
- if(results.isEmpty()) {
- return null;
- }
- StringBuilder sb = new StringBuilder(values.length);
- for(String value : results) {
- sb.append(value).append(PROPERTY_VALUE_DELIMITER);
- }
- sb.deleteCharAt(sb.length() - 1); // remove the last delimiter
- return sb.toString();
- }
-
-
- // ********** refactoring ************
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java
deleted file mode 100644
index 11431d2f8b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.context.JpaContextNode;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
-
-/**
- * Use this abstract class for context nodes that are part of an
- * <code>orm.xml</code> file.
- * This will not work for a pure {@link org.eclipse.jpt.jpa.core.context.MappingFile}
- * implementation.
- */
-public abstract class AbstractPersistenceXmlContextNode
- extends AbstractXmlContextNode
-{
- // ********** constructor **********
-
- protected AbstractPersistenceXmlContextNode(JpaContextNode parent) {
- super(parent);
- }
-
-
- // ********** convenience methods **********
-
- protected PersistenceXmlDefinition getPersistenceXmlDefinition() {
- return (PersistenceXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.getResourceType());
- }
-
- protected EFactory getResourceNodeFactory() {
- return this.getPersistenceXmlDefinition().getResourceNodeFactory();
- }
-
- protected PersistenceXmlContextNodeFactory getContextNodeFactory() {
- return this.getPersistenceXmlDefinition().getContextNodeFactory();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
deleted file mode 100644
index 46e333c58d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java
+++ /dev/null
@@ -1,75 +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.jpa.core.internal.context.persistence;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.java.JarFile;
-import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
-import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJarFile;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericClassRef;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericJarFileRef;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericMappingFileRef;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistence;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnitProperty;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.ImpliedMappingFileRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
-
-public abstract class AbstractPersistenceXmlContextNodeFactory implements PersistenceXmlContextNodeFactory
-{
-
- public Persistence buildPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) {
- return new GenericPersistence(parent, xmlPersistence);
- }
-
- public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
- return new GenericPersistenceUnit(parent, xmlPersistenceUnit);
- }
-
- public MappingFileRef buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
- return new GenericMappingFileRef(parent, xmlMappingFileRef);
- }
-
- public MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent) {
- return new ImpliedMappingFileRef(parent, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString());
- }
-
- public ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef classRef) {
- return new GenericClassRef(parent, classRef);
- }
-
- public ClassRef buildClassRef(PersistenceUnit parent, String className) {
- return new GenericClassRef(parent, className);
- }
-
- public JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
- return new GenericJarFileRef(parent, xmlJarFileRef);
- }
-
- public JarFile buildJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) {
- return new GenericJarFile(parent, jarResourcePackageFragmentRoot);
- }
-
- public PersistenceUnit.Property buildProperty(PersistenceUnit parent, XmlProperty xmlProperty) {
- return new GenericPersistenceUnitProperty(parent, xmlProperty);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java
deleted file mode 100644
index 712ef7e546..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.persistence;
-
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
-
-/**
- * All the state in the definition should be "static"
- * (i.e. unchanging once it is initialized).
- */
-public abstract class AbstractPersistenceXmlDefinition
- implements PersistenceXmlDefinition
-{
- private final PersistenceXmlContextNodeFactory factory;
-
-
- /**
- * zero-argument constructor
- */
- protected AbstractPersistenceXmlDefinition() {
- super();
- this.factory = this.buildContextNodeFactory();
- }
-
- protected abstract PersistenceXmlContextNodeFactory buildContextNodeFactory();
-
- public PersistenceXmlContextNodeFactory getContextNodeFactory() {
- return this.factory;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java
deleted file mode 100644
index 3f329ec9bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.context.persistence;
-
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.NullConnection2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.NullOptions2_0;
-
-
-public class GenericPersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory
-{
-
- public PersistenceUnitProperties buildConnection(PersistenceUnit parent) {
- return new NullConnection2_0(parent);
- }
-
- public PersistenceUnitProperties buildOptions(PersistenceUnit parent) {
- return new NullOptions2_0(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java
deleted file mode 100644
index a34318fd10..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase;
-import org.eclipse.wst.common.project.facet.core.IGroup;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public class FacetTools {
-
- public static IGroup MODULES_GROUP = ProjectFacetsManager.getGroup("modules"); //$NON-NLS-1$
-
-
- public static boolean hasModuleFacet(IFacetedProjectBase fproj) {
- for (IProjectFacetVersion fv : fproj.getProjectFacets()) {
- if (MODULES_GROUP.getMembers().contains(fv)) {
- return true;
- }
- }
- return false;
- }
-
- public static IProjectFacetVersion getModuleFacet(IFacetedProjectBase fproj) {
- for (IProjectFacetVersion fv : fproj.getProjectFacets()) {
- if (MODULES_GROUP.getMembers().contains(fv)) {
- return fv;
- }
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java
deleted file mode 100644
index 69485c5d54..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * Performs things common to install, version change
- */
-public abstract class JpaFacetActionDelegate
- implements IDelegate, JpaFacetDataModelProperties
-{
- public final void execute(
- IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
-
- this.execute_(project, fv, config, monitor);
- }
-
- protected void execute_(
- IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
-
- SubMonitor subMonitor = SubMonitor.convert(monitor, 7);
-
- IDataModel dataModel = (IDataModel) config;
-
- // project settings
- JpaPlatformDescription platform = (JpaPlatformDescription) dataModel.getProperty(PLATFORM);
- JptJpaCorePlugin.setJpaPlatformId(project, platform.getId());
- subMonitor.worked(1);
-
- // do NOT use IDataModel.getStringProperty(String) - or the connection profile name can
- // be set to an empty string - we want it to be null
- JptJpaCorePlugin.setConnectionProfileName(project, (String) dataModel.getProperty(CONNECTION));
- subMonitor.worked(1);
-
- if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
- JptJpaCorePlugin.setUserOverrideDefaultCatalog(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_CATALOG));
- }
- subMonitor.worked(1);
-
- if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
- JptJpaCorePlugin.setUserOverrideDefaultSchema(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_SCHEMA));
- }
- subMonitor.worked(1);
-
- JptJpaCorePlugin.setDiscoverAnnotatedClasses(project, dataModel.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES));
- subMonitor.worked(1);
-
- // defaults settings
- JptJpaCorePlugin.setDefaultJpaPlatformId(fv.getVersionString(), platform.getId());
- subMonitor.worked(1);
-
- //Delegate to LibraryInstallDelegate to configure the project classpath
- ((LibraryInstallDelegate) dataModel.getProperty(JpaFacetDataModelProperties.LIBRARY_PROVIDER_DELEGATE)).execute(subMonitor.newChild(1));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java
deleted file mode 100644
index 9b3c1b5b0a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties;
-
-public interface JpaFacetDataModelProperties
- extends IDataModelProperties
-{
- String PREFIX = "JpaFacetDataModelProperties";
- String PREFIX_ = PREFIX + '.';
-
- /**
- * Internal, type IRuntime, identifies runtime associated with project
- * Used only in conjunction with validation of other properties, because this information
- * is otherwise inaccessible to this data model
- */
- String RUNTIME = PREFIX_ + "RUNTIME";
-
- /**
- * Required, type JpaPlatformDescription, identifies Jpa Platform
- */
- String PLATFORM = PREFIX_ + "PLATFORM";
-
- /**
- * Required, type LibraryInstallDelegate, the library install delegate used to configure JPA provider library
- */
- String LIBRARY_PROVIDER_DELEGATE = PREFIX_ + "LIBRARY_PROVIDER_DELEGATE";
-
- /**
- * Not required, type String, identifies database connection
- */
- String CONNECTION = PREFIX_ + "CONNECTION";
-
- /**
- * Required, type Boolean, identifies whether database connection is active
- */
- String CONNECTION_ACTIVE = PREFIX_ + "CONNECTION_ACTIVE";
-
- /**
- * Required, type Boolean, identifies if the user wishes to override default Catalog name
- */
- String USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG = PREFIX_ + "USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG";
-
- /**
- * Not required, type String, identifies the user overridden default Catalog name
- */
- String USER_OVERRIDE_DEFAULT_CATALOG = PREFIX_ + "USER_OVERRIDE_DEFAULT_CATALOG";
-
- /**
- * Required, type Boolean, identifies if the user wishes to override default schema name
- */
- String USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA = PREFIX_ + "USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA";
-
- /**
- * Not required, type String, identifies the user overridden default schema name
- */
- String USER_OVERRIDE_DEFAULT_SCHEMA = PREFIX_ + "USER_OVERRIDE_DEFAULT_SCHEMA";
-
- /**
- * Required, type boolean, opposite of LIST_ANNOTATED_CLASSES, identifies
- * whether all annotated classes are to be automatically included as part of
- * all persistence units
- */
- String DISCOVER_ANNOTATED_CLASSES = PREFIX_ + "DISCOVER_ANNOTATED_CLASSES";
-
- /**
- * Required, type boolean, opposite of DISCOVER_ANNOTATED_CLASSES, identifies
- * if annotated classes should be listed in the persistence.xml in order to
- * be considered part of a persistence unit
- * (This additional setting is necessary in order to use synchHelper within
- * the wizard - there must be a unique property for each radio button. Stupid
- * but true)
- */
- String LIST_ANNOTATED_CLASSES = PREFIX_ + "LIST_ANNOTATED_CLASSES";
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
deleted file mode 100644
index 0d4ef5ff90..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java
+++ /dev/null
@@ -1,735 +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.jpa.core.internal.facet;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
-import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.ConnectionProfile;
-import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
-import org.eclipse.jpt.jpa.db.Database;
-import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
-import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider;
-import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-
-public abstract class JpaFacetDataModelProvider
- extends FacetInstallDataModelProvider
- implements JpaFacetDataModelProperties
-{
- protected static final String EJB_FACET_ID = IModuleConstants.JST_EJB_MODULE;
-
- protected static final IStatus PLATFORM_NOT_SPECIFIED_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_NOT_SPECIFIED);
-
- protected static final IStatus CONNECTION_NOT_CONNECTED_STATUS =
- buildInfoStatus(JptCoreMessages.VALIDATE_CONNECTION_NOT_CONNECTED);
-
- protected static final IStatus USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED);
-
- protected static final IStatus USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED);
-
-
- private LibraryInstallDelegate defaultLibraryProvider;
-
- /** cache the connection profile - change it whenever the user selects a different name */
- private ConnectionProfile connectionProfile;
-
-
- /**
- * required default constructor
- */
- protected JpaFacetDataModelProvider() {
- super();
- }
-
-
- @Override
- public Set<String> getPropertyNames() {
- @SuppressWarnings("unchecked") Set<String> propertyNames = super.getPropertyNames();
- propertyNames.add(RUNTIME);
- propertyNames.add(PLATFORM);
- propertyNames.add(LIBRARY_PROVIDER_DELEGATE);
- propertyNames.add(CONNECTION);
- propertyNames.add(CONNECTION_ACTIVE);
- propertyNames.add(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG);
- propertyNames.add(USER_OVERRIDE_DEFAULT_CATALOG);
- propertyNames.add(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA);
- propertyNames.add(USER_OVERRIDE_DEFAULT_SCHEMA);
- propertyNames.add(DISCOVER_ANNOTATED_CLASSES);
- propertyNames.add(LIST_ANNOTATED_CLASSES);
- return propertyNames;
- }
-
-
- // ********** properties **********
-
- protected IFacetedProjectWorkingCopy getFacetedProjectWorkingCopy() {
- return (IFacetedProjectWorkingCopy) this.getProperty(FACETED_PROJECT_WORKING_COPY);
- }
-
- protected IProjectFacetVersion getProjectFacetVersion() {
- return (IProjectFacetVersion) this.getProperty(FACET_VERSION);
- }
-
- protected IRuntime getRuntime() {
- return (IRuntime) this.getProperty(RUNTIME);
- }
-
- protected JpaPlatformDescription getPlatform() {
- return (JpaPlatformDescription) getProperty(PLATFORM);
- }
-
- protected LibraryInstallDelegate getLibraryInstallDelegate() {
- return (LibraryInstallDelegate) this.getProperty(LIBRARY_PROVIDER_DELEGATE);
- }
-
- protected String getConnectionName() {
- return (String) this.getProperty(CONNECTION);
- }
-
- protected boolean userWantsToOverrideDefaultCatalog() {
- return this.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG);
- }
-
- protected String getUserOverrideDefaultCatalog() {
- return (String) this.getProperty(USER_OVERRIDE_DEFAULT_CATALOG);
- }
-
- protected boolean userWantsToOverrideDefaultSchema() {
- return this.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA);
- }
-
- protected String getUserOverrideDefaultSchema() {
- return (String) this.getProperty(USER_OVERRIDE_DEFAULT_SCHEMA);
- }
-
- protected boolean discoverAnnotatedClasses() {
- return this.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES);
- }
-
-
- // ********** enabled **********
-
- @Override
- public boolean isPropertyEnabled(String propertyName) {
- if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
- return this.connectionIsActive() && this.databaseSupportsCatalogs();
- }
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
- return this.userWantsToOverrideDefaultCatalog();
- }
- if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
- return this.connectionIsActive();
- }
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
- return this.userWantsToOverrideDefaultSchema();
- }
-
- return super.isPropertyEnabled(propertyName);
- }
-
-
- // ********** defaults **********
-
- @Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(FACET_ID)) {
- return JpaFacet.ID;
- }
- if (propertyName.equals(RUNTIME)) {
- return null;
- }
- if (propertyName.equals(PLATFORM)) {
- return getDefaultPlatform();
- }
- if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) {
- return getDefaultLibraryProvider();
- }
- if (propertyName.equals(CONNECTION)) {
- return getDefaultConnection();
- }
- if (propertyName.equals(CONNECTION_ACTIVE)) {
- return Boolean.valueOf(this.connectionIsActive());
- }
- if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) {
- return getDefaultUserWantsToOverrideDefaultCatalog();
- }
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
- return getDefaultCatalogIdentifier();
- }
- if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) {
- return getDefaultUserWantsToOverrideDefaultSchema();
- }
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
- return getDefaultSchemaIdentifier();
- }
- if (propertyName.equals(DISCOVER_ANNOTATED_CLASSES)) {
- return getDefaultDiscoverAnnotatedClasses();
- }
- if (propertyName.equals(LIST_ANNOTATED_CLASSES)) {
- return getDefaultListAnnotatedClasses();
- }
-
- return super.getDefaultProperty(propertyName);
- }
-
- protected abstract JpaPlatformDescription getDefaultPlatform();
-
- protected LibraryInstallDelegate getDefaultLibraryProvider() {
- // delegate itself changes only when facet version changes
- if (this.defaultLibraryProvider == null) {
- this.defaultLibraryProvider = buildDefaultLibraryProvider();
- }
- else if (! this.defaultLibraryProvider.getProjectFacetVersion().equals(getProjectFacetVersion())) {
- this.defaultLibraryProvider.dispose();
- this.defaultLibraryProvider = buildDefaultLibraryProvider();
- }
- return defaultLibraryProvider;
- }
-
- protected LibraryInstallDelegate buildDefaultLibraryProvider() {
- IFacetedProjectWorkingCopy fpjwc = this.getFacetedProjectWorkingCopy();
- if (fpjwc == null) {
- return null;
- }
- IProjectFacetVersion pfv = this.getProjectFacetVersion();
- if (pfv == null) {
- return null;
- }
-
- Map<String, Object> customEnablementVariables = new HashMap<String, Object>();
- JpaPlatformDescription jpaPlatform = getPlatform();
- String jpaPlatformId = (jpaPlatform == null) ? "" : jpaPlatform.getId();
- customEnablementVariables.put(
- JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, jpaPlatformId);
- customEnablementVariables.put(
- JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, jpaPlatform);
-
- LibraryInstallDelegate lp = new LibraryInstallDelegate(fpjwc, pfv, customEnablementVariables);
- 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) {
- JpaPlatformDescription jpaPlatform = getPlatform();
- String jpaPlatformId = (jpaPlatform == null) ? "" : jpaPlatform.getId();
-
- lid.setEnablementContextVariable(
- JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, jpaPlatformId);
- lid.setEnablementContextVariable(
- JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, jpaPlatform);
-
- List<JpaLibraryProviderInstallOperationConfig> jpaConfigs
- = new ArrayList<JpaLibraryProviderInstallOperationConfig>();
- // add the currently selected one first
- JpaLibraryProviderInstallOperationConfig currentJpaConfig = null;
- LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig();
- if (config instanceof JpaLibraryProviderInstallOperationConfig) {
- currentJpaConfig = (JpaLibraryProviderInstallOperationConfig) config;
- jpaConfigs.add(currentJpaConfig);
- }
- for (ILibraryProvider lp : lid.getLibraryProviders()) {
- config = lid.getLibraryProviderOperationConfig(lp);
- if (config instanceof JpaLibraryProviderInstallOperationConfig
- && ! config.equals(currentJpaConfig)) {
- jpaConfigs.add((JpaLibraryProviderInstallOperationConfig) config);
- }
- }
- for (JpaLibraryProviderInstallOperationConfig jpaConfig : jpaConfigs) {
- jpaConfig.setJpaPlatform(getPlatform());
- }
- }
- }
-
-
- // ********** property descriptors **********
-
- @Override
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(PLATFORM)) {
- return this.buildValidPlatformDescriptors();
- }
- if (propertyName.equals(CONNECTION)) {
- return this.buildValidConnectionDescriptors();
- }
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
- return this.buildValidCatalogDescriptors();
- }
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
- return this.buildValidSchemaDescriptors();
- }
-
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- protected DataModelPropertyDescriptor[] buildValidPlatformDescriptors() {
- Iterable<JpaPlatformDescription> validPlatformDescriptions = buildValidPlatformDescriptions();
- Iterable<DataModelPropertyDescriptor> validPlatformDescriptors =
- new TransformationIterable<JpaPlatformDescription, DataModelPropertyDescriptor>(validPlatformDescriptions) {
- @Override
- protected DataModelPropertyDescriptor transform(JpaPlatformDescription desc) {
- return buildPlatformDescriptor(desc);
- }
- };
- return ArrayTools.sort(ArrayTools.array(validPlatformDescriptors, EMPTY_DMPD_ARRAY), DESCRIPTOR_COMPARATOR);
- }
-
- protected Iterable<JpaPlatformDescription> buildValidPlatformDescriptions() {
- return new FilteringIterable<JpaPlatformDescription>(
- JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatforms()) {
- @Override
- protected boolean accept(JpaPlatformDescription o) {
- return o.supportsJpaFacetVersion(getProjectFacetVersion());
- }
- };
- }
-
- protected static final Comparator<DataModelPropertyDescriptor> DESCRIPTOR_COMPARATOR =
- new Comparator<DataModelPropertyDescriptor>() {
- public int compare(DataModelPropertyDescriptor dmpd1, DataModelPropertyDescriptor dmpd2) {
- return dmpd1.getPropertyDescription().compareTo(dmpd2.getPropertyDescription());
- }
- };
-
- protected DataModelPropertyDescriptor[] buildValidConnectionDescriptors() {
- List<String> connectionNames = this.buildValidConnectionNames();
- DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[connectionNames.size()];
- for (int i = 0; i < descriptors.length; i++) {
- descriptors[i] = this.buildConnectionDescriptor(connectionNames.get(i));
- }
- return descriptors;
- }
-
- /**
- * put a null entry at the top of the list (for <none>)
- */
- protected List<String> buildValidConnectionNames() {
- List<String> connectionNames = CollectionTools.sort(CollectionTools.list(this.getConnectionProfileNames()));
- connectionNames.add(0, null);
- return connectionNames;
- }
-
- protected DataModelPropertyDescriptor[] buildValidCatalogDescriptors() {
- Database db = this.getDatabase();
- return (db == null) ? EMPTY_DMPD_ARRAY : this.buildDescriptors(this.buildValidCatalogIdentifiers(db));
- }
-
- /**
- * pre-condition: 'db' is not null
- */
- protected List<String> buildValidCatalogIdentifiers(Database db) {
- // use catalog *identifiers* since the string ends up being the "default" for various text entries
- return this.buildValidStrings(db.getSortedCatalogIdentifiers(), this.getDefaultCatalogIdentifier());
- }
-
- protected DataModelPropertyDescriptor[] buildValidSchemaDescriptors() {
- Database db = this.getDatabase();
- return (db == null) ? EMPTY_DMPD_ARRAY : this.buildDescriptors(this.buildValidSchemaIdentifiers());
- }
-
- protected List<String> buildValidSchemaIdentifiers() {
- return this.buildValidStrings(this.getSchemaIdentifiers(), this.getDefaultSchemaIdentifier());
- }
-
- protected Iterable<String> getSchemaIdentifiers() {
- SchemaContainer sc = this.getSchemaContainer();
- // use schema *identifiers* since the string ends up being the "default" for various text entries
- return (sc != null) ? sc.getSortedSchemaIdentifiers() : EmptyIterable.<String>instance();
- }
-
- /**
- * put an entry for the default at the top of the list
- */
- protected List<String> buildValidStrings(Iterable<String> strings, String defaultString) {
- List<String> validStrings = CollectionTools.list(strings);
- if ((defaultString != null) && ! validStrings.contains(defaultString)) {
- validStrings.add(0, defaultString);
- }
- return validStrings;
- }
-
- protected DataModelPropertyDescriptor[] buildDescriptors(List<String> strings) {
- DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[strings.size()];
- for (int i = 0; i < descriptors.length; i++) {
- descriptors[i] = new DataModelPropertyDescriptor(strings.get(i));
- }
- return descriptors;
- }
-
- protected static final DataModelPropertyDescriptor[] EMPTY_DMPD_ARRAY = new DataModelPropertyDescriptor[0];
-
- /**
- * platform and connection have 'description's (in addition to 'value's)
- */
- @Override
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (propertyName.equals(PLATFORM)) {
- return buildPlatformDescriptor(this.getPlatform());
- }
- if (propertyName.equals(CONNECTION)) {
- return buildConnectionDescriptor(this.getConnectionName());
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
- protected DataModelPropertyDescriptor buildPlatformDescriptor(JpaPlatformDescription platform) {
- return new DataModelPropertyDescriptor(platform, platform.getLabel());
- }
-
- protected String getPlatformLabel(String platformId) {
- return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(platformId).getLabel();
- }
-
- protected DataModelPropertyDescriptor buildConnectionDescriptor(String connectionName) {
- String description = (connectionName == null) ? JptCoreMessages.NONE : null;
- return new DataModelPropertyDescriptor(connectionName, description);
- }
-
-
- // ********** database **********
-
- protected SchemaContainer getSchemaContainer() {
- return this.databaseSupportsCatalogs() ? this.getCatalog() : this.getDatabase();
- }
-
- protected Catalog getCatalog() {
- String name = this.getUserOverrideDefaultCatalog();
- return (name == null) ? null : this.getCatalog(name);
- }
-
- /**
- * pre-condition: 'name' is not null
- */
- protected Catalog getCatalog(String name) {
- Database db = this.getDatabase();
- return (db == null) ? null : db.getCatalogForIdentifier(name);
- }
-
- protected boolean databaseSupportsCatalogs() {
- Database db = this.getDatabase();
- return (db != null) && db.supportsCatalogs();
- }
-
- protected Database getDatabase() {
- ConnectionProfile cp = this.getConnectionProfile();
- return (cp == null) ? null : cp.getDatabase();
- }
-
- protected boolean connectionIsActive() {
- ConnectionProfile cp = this.getConnectionProfile();
- return (cp != null) && cp.isActive();
- }
-
- protected ConnectionProfile getConnectionProfile() {
- String name = this.getConnectionName();
- return (name == null) ? null : this.getConnectionProfile(name);
- }
-
- /**
- * pre-condition: 'name' is not null
- */
- protected ConnectionProfile getConnectionProfile(String name) {
- if (this.cachedConnectionProfileIsStale(name)) {
- this.connectionProfile = this.buildConnectionProfile(name);
- }
- return this.connectionProfile;
- }
-
- protected boolean cachedConnectionProfileIsStale(String name) {
- return (this.connectionProfile == null) || ! this.connectionProfile.getName().equals(name);
- }
-
- protected ConnectionProfile buildConnectionProfile(String name) {
- return this.getConnectionProfileFactory().buildConnectionProfile(name, DatabaseIdentifierAdapter.Default.instance());
- }
-
- protected Iterable<String> getConnectionProfileNames() {
- return this.getConnectionProfileFactory().getConnectionProfileNames();
- }
-
- protected ConnectionProfileFactory getConnectionProfileFactory() {
- // we don't have a JPA project yet, so go to the db plug-in directly to get the factory
- return JptJpaDbPlugin.getConnectionProfileFactory();
- }
-
-
- // ********** validation **********
-
- @Override
- public IStatus validate(String propertyName) {
- if (propertyName.equals(PLATFORM)) {
- return this.validatePlatform();
- }
- if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) {
- return this.getLibraryInstallDelegate().validate();
- }
- if (propertyName.equals(CONNECTION)) {
- return this.validateConnection();
- }
- if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)
- || propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
- return this.validateUserOverrideDefaultCatalog();
- }
- if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)
- || propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
- return this.validateUserOverrideDefaultSchema();
- }
- if (propertyName.equals(DISCOVER_ANNOTATED_CLASSES)) {
- return this.validatePersistentClassManagement();
- }
-
- return super.validate(propertyName);
- }
-
- protected IStatus validatePlatform() {
- return (this.getPlatform() == null) ? PLATFORM_NOT_SPECIFIED_STATUS : OK_STATUS;
- }
-
- protected IStatus validateConnection() {
- String connectionName = this.getConnectionName();
- return (connectionName == null) ? OK_STATUS : this.validateNonNullConnection(connectionName);
- }
-
- protected IStatus validateNonNullConnection(String connectionName) {
- ConnectionProfile cp = this.getConnectionProfile(connectionName);
- if (cp == null) {
- return buildErrorStatus(NLS.bind(JptCoreMessages.VALIDATE_CONNECTION_INVALID, connectionName));
- }
- if ( ! cp.isActive()) {
- return CONNECTION_NOT_CONNECTED_STATUS;
- }
- return OK_STATUS;
- }
-
- protected IStatus validateUserOverrideDefaultCatalog() {
- if (this.userWantsToOverrideDefaultCatalog()) {
- if (this.getUserOverrideDefaultCatalog() == null) {
- return USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS;
- }
- }
- return OK_STATUS;
- }
-
- protected IStatus validateUserOverrideDefaultSchema() {
- if (this.userWantsToOverrideDefaultSchema()) {
- if (this.getUserOverrideDefaultSchema() == null) {
- return USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS;
- }
- }
- return OK_STATUS;
- }
-
- protected IStatus validatePersistentClassManagement() {
- // TODO warning if "discovery" is used, but no runtime specified ??
- // boolean discoverAnnotatedClasses = this.discoverAnnotatedClasses();
- return OK_STATUS;
- }
-
-
- // ********** static methods **********
-
- protected static IStatus buildInfoStatus(String message) {
- return buildStatus(IStatus.INFO, message);
- }
-
-// private static IStatus buildWarningStatus(String message) {
-// return buildStatus(IStatus.WARNING, message);
-// }
-
- protected static IStatus buildErrorStatus(String message) {
- return buildStatus(IStatus.ERROR, message);
- }
-
- protected static IStatus buildStatus(int severity, String message) {
- return new Status(severity, JptJpaCorePlugin.PLUGIN_ID, message);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java
deleted file mode 100644
index a72c4206a3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-@SuppressWarnings("nls")
-public interface JpaFacetInstallDataModelProperties
- extends JpaFacetDataModelProperties
-{
- String PREFIX = "JpaFacetInstallDataModelProperties";
- String PREFIX_ = PREFIX + '.';
-
- /**
- * Required, type Boolean, identifies if the user wishes to add the database driver jars to the classpath
- */
- String USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH = PREFIX_ + "USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH";
-
- /**
- * Not required, type String, identifies the database driver library added to the classpath
- */
- String DB_DRIVER_NAME = PREFIX_ + "DB_DRIVER_NAME";
-
- /**
- * Required, type boolean, details whether orm.xml should be created
- */
- String CREATE_ORM_XML = PREFIX_ + "CREATE_ORM_XML";
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java
deleted file mode 100644
index a70e069003..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-import java.util.Set;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.db.ConnectionProfile;
-import org.eclipse.jpt.jpa.db.Database;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class JpaFacetInstallDataModelProvider
- extends JpaFacetDataModelProvider
- implements JpaFacetInstallDataModelProperties
-{
- /**
- * required default constructor
- */
- public JpaFacetInstallDataModelProvider() {
- super();
- }
-
- @Override
- public Set<String> getPropertyNames() {
- Set<String> propertyNames = super.getPropertyNames();
- propertyNames.add(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH);
- propertyNames.add(DB_DRIVER_NAME);
- propertyNames.add(CREATE_ORM_XML);
- return propertyNames;
- }
-
-
- // ********** properties **********
-
- protected boolean userWantsToAddDbDriverJarsToClasspath() {
- return this.getBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH);
- }
-
- protected String getDriverName() {
- return (String) this.getProperty(DB_DRIVER_NAME);
- }
-
-
- // ********** enabled **********
-
- @Override
- public boolean isPropertyEnabled(String propertyName) {
- if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
- return (this.getConnectionProfile() != null);
- }
- if (propertyName.equals(DB_DRIVER_NAME)) {
- return this.userWantsToAddDbDriverJarsToClasspath();
- }
-
- return super.isPropertyEnabled(propertyName);
- }
-
-
- // ********** defaults **********
-
- @Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
- return Boolean.FALSE;
- }
- if (propertyName.equals(DB_DRIVER_NAME)) {
- return this.getDefaultDriverName();
- }
- if (propertyName.equals(CREATE_ORM_XML)) {
- return Boolean.FALSE;
- }
-
- return super.getDefaultProperty(propertyName);
- }
-
- @Override
- protected JpaPlatformDescription getDefaultPlatform() {
- return JptJpaCorePlugin.getDefaultJpaPlatform(getProjectFacetVersion());
- }
-
- @Override
- protected String getDefaultConnection() {
- return null;
- }
-
- @Override
- protected Boolean getDefaultUserWantsToOverrideDefaultCatalog() {
- return Boolean.FALSE;
- }
-
- @Override
- protected String getDefaultCatalogIdentifier() {
- Database db = this.getDatabase();
- return (db == null) ? null : db.getDefaultCatalogIdentifier();
- }
-
- @Override
- protected Boolean getDefaultUserWantsToOverrideDefaultSchema() {
- return Boolean.FALSE;
- }
-
- @Override
- protected String getDefaultSchemaIdentifier() {
- SchemaContainer sc = this.getSchemaContainer();
- return (sc == null) ? null : sc.getDefaultSchemaIdentifier();
- }
-
- protected String getDefaultDriverName() {
- ConnectionProfile cp = this.getConnectionProfile();
- return (cp == null) ? null : cp.getDriverName();
- }
-
- @Override
- protected Boolean getDefaultDiscoverAnnotatedClasses() {
- return Boolean.valueOf(this.runtimeSupportsEjb30());
- }
-
-
- // ********** synchronize data model **********
-
- /**
- * The specified property's value has changed to the specified value.
- * Return whether to fire a VALUE_CHG DataModelEvent.
- */
- @Override
- public boolean propertySet(String propertyName, Object propertyValue) {
- boolean ok = super.propertySet(propertyName, propertyValue);
-
- if (propertyName.equals(CONNECTION)) {
- // db driver
- if (propertyValue == null) { // connection set to '<None>'
- this.setBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH, false);
- }
- this.model.notifyPropertyChange(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH, IDataModel.ENABLE_CHG);
- this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.DEFAULT_CHG);
- this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.VALID_VALUES_CHG);
- }
- else if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
- this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.ENABLE_CHG);
- if (this.propertyValueIsFalse(propertyValue)) {
- this.setProperty(DB_DRIVER_NAME, null);
- }
- }
-
- return ok;
- }
-
-
- // ********** property descriptors **********
-
- @Override
- public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) {
- if (propertyName.equals(PLATFORM)) {
- return this.buildValidPlatformDescriptors();
- }
-
- if (propertyName.equals(CONNECTION)) {
- return this.buildValidConnectionDescriptors();
- }
-
- if (propertyName.equals(DB_DRIVER_NAME)) {
- return this.buildValidDriverDescriptors();
- }
-
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) {
- return this.buildValidCatalogDescriptors();
- }
-
- if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) {
- return this.buildValidSchemaDescriptors();
- }
-
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- protected DataModelPropertyDescriptor[] buildValidDriverDescriptors() {
- return new DataModelPropertyDescriptor[] { new DataModelPropertyDescriptor(this.getDriverName()) };
- }
-
-
- // ********** validation **********
-
- @Override
- public IStatus validate(String propertyName) {
- if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)
- || propertyName.equals(DB_DRIVER_NAME)) {
- return this.validateDbDriverName();
- }
-
- return super.validate(propertyName);
- }
-
- protected IStatus validateDbDriverName() {
- return OK_STATUS;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java
deleted file mode 100644
index 5c07250f1a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.resource.ResourceLocator;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider;
-import org.eclipse.jpt.jpa.core.internal.operations.PersistenceFileCreationDataModelProvider;
-import org.eclipse.jpt.jpa.db.JptJpaDbPlugin;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-import org.eclipse.wst.validation.ValidationFramework;
-
-/**
- * We don't really "install" the JPA facet here. We simply store all the various
- * data model properties in the appropriate preferences. These settings will
- * used in the POST_INSTALL event listener to build the JPA project.
- */
-public class JpaFacetInstallDelegate
- extends JpaFacetActionDelegate
- implements JpaFacetInstallDataModelProperties
-{
- @Override
- protected void execute_(
- IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
-
- SubMonitor sm = SubMonitor.convert(monitor, 10);
-
- ValidationFramework.getDefault().addValidationBuilder(project);
-
- super.execute_(project, fv, config, sm.newChild(1));
-
- IJavaProject javaProject = JavaCore.create(project);
- IDataModel dataModel = (IDataModel) config;
-
- // project settings
- this.addDbDriverLibraryToClasspath(javaProject, dataModel, sm.newChild(1));
-
- // create project XML files
- this.createProjectXml(project, dataModel.getBooleanProperty(CREATE_ORM_XML), sm.newChild(8));
- }
-
- protected void addDbDriverLibraryToClasspath(
- IJavaProject javaProject, IDataModel dataModel,
- IProgressMonitor monitor) throws CoreException {
-
- if( ! dataModel.getBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) {
- return;
- }
- String driverName = dataModel.getStringProperty(DB_DRIVER_NAME);
-
- IClasspathContainer container = JptJpaDbPlugin.instance().buildDriverClasspathContainerFor(driverName);
- IClasspathEntry entry = JavaCore.newContainerEntry(container.getPath());
- this.addClasspathEntryToProject(entry, javaProject, monitor);
- }
-
- private void addClasspathEntryToProject(
- IClasspathEntry classpathEntry, IJavaProject javaProject, IProgressMonitor monitor)
- throws CoreException {
-
- // if the classpathEntry is already there, do nothing
- IClasspathEntry[] classpath = javaProject.getRawClasspath();
- if (ArrayTools.contains(classpath, classpathEntry)) {
- return;
- }
-
- // add the given classpathEntry to the project classpath
- int len = classpath.length;
- IClasspathEntry[] newClasspath = new IClasspathEntry[len + 1];
- System.arraycopy(classpath, 0, newClasspath, 0, len);
- newClasspath[len] = classpathEntry;
- javaProject.setRawClasspath(newClasspath, monitor);
- }
-
- private void createProjectXml(IProject project, boolean buildOrmXml, IProgressMonitor monitor) {
- int tasks = 1 + (buildOrmXml ? 1 : 0);
- SubMonitor sm = SubMonitor.convert(monitor, tasks);
-
- this.createPersistenceXml(project, sm.newChild(1));
- if (buildOrmXml) {
- this.createOrmXml(project, sm.newChild(1));
- }
- }
-
- private void createPersistenceXml(IProject project, IProgressMonitor monitor) {
- SubMonitor sm = SubMonitor.convert(monitor, 5);
-
- IDataModel config = DataModelFactory.createDataModel(new PersistenceFileCreationDataModelProvider());
- config.setProperty(CONTAINER_PATH, defaultResourceLocation(project));
- sm.worked(1);
- // default values for all other properties should suffice
- try {
- config.getDefaultOperation().execute(sm.newChild(4), null);
- } catch (ExecutionException ex) {
- JptJpaCorePlugin.log(ex);
- }
- }
-
- private void createOrmXml(IProject project, IProgressMonitor monitor) {
- SubMonitor sm = SubMonitor.convert(monitor, 5);
-
- IDataModel config = DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider());
- config.setProperty(CONTAINER_PATH, defaultResourceLocation(project));
- sm.worked(1);
- // default values for all other properties should suffice
- try {
- config.getDefaultOperation().execute(sm.newChild(4), null);
- } catch (ExecutionException ex) {
- JptJpaCorePlugin.log(ex);
- }
- }
-
- protected IPath defaultResourceLocation(IProject project) {
- ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(project);
- if (resourceLocator == null) {
- JptJpaCorePlugin.log("No resource locator for project");
- return null;
- }
- return resourceLocator.getDefaultResourceLocation(project).getFullPath();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java
deleted file mode 100644
index b71b2ce923..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.wst.common.project.facet.core.IDelegate;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class JpaFacetUninstallDelegate
- implements IDelegate
-{
- public void execute(IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException {
-
- JptJpaCorePlugin.clearProjectPreferences(project);
- JptJpaCorePlugin.clearProjectPersistentProperties(project);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java
deleted file mode 100644
index ab06bfed9c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-
-public class JpaFacetVersionChangeDataModelProvider
- extends JpaFacetDataModelProvider
- implements JpaFacetDataModelProperties
-{
- protected static final IStatus PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS =
- buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION);
-
-
- /**
- * required default constructor
- */
- public JpaFacetVersionChangeDataModelProvider() {
- super();
- }
-
-
- protected String getProjectName() {
- return getStringProperty(FACET_PROJECT_NAME);
- }
-
- protected JpaProject getJpaProject() {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
- return JptJpaCorePlugin.getJpaProject(project);
- }
-
-
- // **************** defaults **********************************************
-
- @Override
- protected JpaPlatformDescription getDefaultPlatform() {
- return getJpaProject().getJpaPlatform().getDescription();
- }
-
- @Override
- protected String getDefaultConnection() {
- return getJpaProject().getDataSource().getConnectionProfileName();
- }
-
- @Override
- protected Boolean getDefaultUserWantsToOverrideDefaultCatalog() {
- return getJpaProject().getUserOverrideDefaultCatalog() != null;
- }
-
- @Override
- protected String getDefaultCatalogIdentifier() {
- return getJpaProject().getUserOverrideDefaultCatalog();
- }
-
- @Override
- protected Boolean getDefaultUserWantsToOverrideDefaultSchema() {
- return getJpaProject().getUserOverrideDefaultSchema() != null;
- }
-
- @Override
- protected String getDefaultSchemaIdentifier() {
- return getJpaProject().getDefaultSchema();
- }
-
- @Override
- protected Boolean getDefaultDiscoverAnnotatedClasses() {
- return getJpaProject().discoversAnnotatedClasses();
- }
-
-
- // **************** valid property descriptors ****************************
-
- @Override
- protected Iterable<JpaPlatformDescription> buildValidPlatformDescriptions() {
- // add existing platform to list of choices
- Iterable<JpaPlatformDescription> validPlatformDescs = super.buildValidPlatformDescriptions();
- if (! CollectionTools.contains(validPlatformDescs, getDefaultPlatform())) {
- validPlatformDescs = new CompositeIterable(getDefaultPlatform(), validPlatformDescs);
- }
- return validPlatformDescs;
- }
-
-
- // **************** validation ********************************************
-
- @Override
- protected IStatus validatePlatform() {
- IStatus status = super.validatePlatform();
-
- if (status.isOK()) {
- if (! getPlatform().supportsJpaFacetVersion(getProjectFacetVersion())) {
- status = PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS;
- }
- }
-
- return status;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java
deleted file mode 100644
index 9935431623..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.facet;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class JpaFacetVersionChangeDelegate
- extends JpaFacetActionDelegate
-{
- @Override
- protected void execute_(
- IProject project, IProjectFacetVersion fv,
- Object config, IProgressMonitor monitor) throws CoreException
- {
- SubMonitor sm = SubMonitor.convert(monitor, 2);
- super.execute_(project, fv, config, sm.newChild(1));
-
- JptJpaCorePlugin.rebuildJpaProject(project);
- sm.worked(1);
- // nothing further to do here *just* yet
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java
deleted file mode 100644
index 88d881e740..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.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.jpa.core.internal.facet;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-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) {
- Map<String, Object> enablementVariables = new HashMap<String, Object>();
- enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_ENABLEMENT_EXP, getJpaPlatformId(fpb.getProject()));
- enablementVariables.put(JpaLibraryProviderInstallOperationConfig.JPA_PLATFORM_DESCRIPTION_ENABLEMENT_EXP, getJpaPlatformDescription(fpb.getProject()));
- LibraryInstallDelegate lp = new LibraryInstallDelegate(fpb, pfv, enablementVariables);
- try {
- lp.execute(new NullProgressMonitor());
- }
- catch (CoreException ce) {
- JptJpaCorePlugin.log(ce);
- }
- }
- }
-
- protected String getJpaPlatformId(IProject project) {
- JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
- return (jpaProject == null) ? null : jpaProject.getJpaPlatform().getId();
- }
-
- protected JpaPlatformDescription getJpaPlatformDescription(IProject project) {
- JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
- return (jpaProject == null) ? null : jpaProject.getJpaPlatform().getDescription();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java
deleted file mode 100644
index b00190e46f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java
+++ /dev/null
@@ -1,228 +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.jpa.core.internal.jpa1;
-
-import org.eclipse.jpt.jpa.core.JpaDataSource;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode;
-import org.eclipse.jpt.jpa.db.ConnectionAdapter;
-import org.eclipse.jpt.jpa.db.ConnectionListener;
-import org.eclipse.jpt.jpa.db.ConnectionProfile;
-import org.eclipse.jpt.jpa.db.ConnectionProfileFactory;
-import org.eclipse.jpt.jpa.db.ConnectionProfileListener;
-import org.eclipse.jpt.jpa.db.Database;
-import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * 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;
-
-
- // ********** constructor/initialization **********
-
- public GenericJpaDataSource(JpaProject jpaProject, String connectionProfileName) {
- super(jpaProject);
- //moving the building of the connection profile before the connectionProfileListener
- //is added. Need to make sure the loading of db profiles is completed before
- //listening, otherwise we get notifications before our model is finished being built.
- //this means our updater is called before it is set which results in an IllegalStateException.
- //Hopefully this change is temporary and DTP will fix bug 246270 where I suggest they
- //not fire events when building profiles.
- this.connectionProfileName = connectionProfileName;
- this.connectionProfile = this.buildConnectionProfile(connectionProfileName);
-
- this.connectionProfileListener = this.buildConnectionProfileListener();
- this.getConnectionProfileFactory().addConnectionProfileListener(this.connectionProfileListener);
-
- this.connectionListener = this.buildConnectionListener();
- if (this.connectionProfile != null) {
- this.connectionProfile.addConnectionListener(this.connectionListener);
- }
- }
-
- protected ConnectionProfileFactory getConnectionProfileFactory() {
- return this.getJpaPlatform().getConnectionProfileFactory();
- }
-
- protected ConnectionProfileListener buildConnectionProfileListener() {
- return new LocalConnectionProfileListener();
- }
-
- protected ConnectionListener buildConnectionListener() {
- return new LocalConnectionListener();
- }
-
-
- // ********** JpaDataSource implementation **********
-
- public String getConnectionProfileName() {
- return this.connectionProfileName;
- }
-
- public void setConnectionProfileName(String name) {
- String old = this.connectionProfileName;
- this.connectionProfileName = name;
- if (this.firePropertyChanged(CONNECTION_PROFILE_NAME_PROPERTY, old, name)) {
- // synch the connection profile when the name changes
- this.setConnectionProfile(this.buildConnectionProfile(name));
- JptJpaCorePlugin.setConnectionProfileName(this.getJpaProject().getProject(), name);
- }
- }
-
- public ConnectionProfile getConnectionProfile() {
- return this.connectionProfile;
- }
-
- @Override
- public boolean connectionProfileIsActive() {
- ConnectionProfile cp = this.connectionProfile;
- return (cp != null) && cp.isActive();
- }
-
- @Override
- public Database getDatabase() {
- ConnectionProfile cp = this.connectionProfile;
- return (cp == null) ? null : cp.getDatabase();
- }
-
- public Table selectTableForIdentifier(Iterable<Table> tables, String identifier) {
- Database db = this.getDatabase();
- return (db == null) ? null : db.selectTableForIdentifier(tables, identifier);
- }
-
- public void dispose() {
- if (this.connectionProfile != null) {
- this.connectionProfile.removeConnectionListener(this.connectionListener);
- }
- this.getConnectionProfileFactory().removeConnectionProfileListener(this.connectionProfileListener);
- }
-
-
- // ********** internal methods **********
-
- protected ConnectionProfile buildConnectionProfile(String name) {
- return this.getConnectionProfileFactory().buildConnectionProfile(name, this.buildDatabaseIdentifierAdapter());
- }
-
- protected DatabaseIdentifierAdapter buildDatabaseIdentifierAdapter() {
- return this.isJpa2_0Compatible() ?
- this.getJpaFactory2_0().buildDatabaseIdentifierAdapter(this) :
- DatabaseIdentifierAdapter.Default.instance();
- }
-
- protected void setConnectionProfile(ConnectionProfile connectionProfile) {
- ConnectionProfile old = this.connectionProfile;
- if (old != null) {
- old.removeConnectionListener(this.connectionListener);
- }
- this.connectionProfile = connectionProfile;
- if (connectionProfile != null) {
- connectionProfile.addConnectionListener(this.connectionListener);
- }
- this.firePropertyChanged(CONNECTION_PROFILE_PROPERTY, old, connectionProfile);
- }
-
-
- // ********** overrides **********
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.connectionProfileName);
- }
-
-
- // ********** member classes **********
-
- /**
- * Listen for a connection profile with our name being removed.
- * Also listen for our connection's name being changed.
- */
- protected class LocalConnectionProfileListener
- implements ConnectionProfileListener
- {
- protected LocalConnectionProfileListener() {
- super();
- }
-
- public void connectionProfileAdded(String name) {
- // check to see if a connection profile with our name was added
- // (assume our connection profile is null)
- if (GenericJpaDataSource.this.connectionProfile == null) {
- if (name.equals(GenericJpaDataSource.this.getConnectionProfileName())) {
- GenericJpaDataSource.this.setConnectionProfileName(name); // this will trigger creation of CP
- }
- }
- }
-
- public void connectionProfileRemoved(String name) {
- if (GenericJpaDataSource.this.connectionProfile == null) {
- return;
- }
- if (name.equals(GenericJpaDataSource.this.connectionProfile.getName())) {
- GenericJpaDataSource.this.setConnectionProfile(null);
- }
- }
-
- public void connectionProfileRenamed(String oldName, String newName) {
- if (GenericJpaDataSource.this.connectionProfile == null) {
- if (newName.equals(GenericJpaDataSource.this.connectionProfileName)) {
- GenericJpaDataSource.this.setConnectionProfileName(newName);
- }
- return;
- }
- // the connection profile will already have the new name,
- // we just need to synch the name held by the data source
- if (newName.equals(GenericJpaDataSource.this.connectionProfile.getName())) {
- GenericJpaDataSource.this.setConnectionProfileName(newName);
- }
- }
- }
-
-
- /**
- * Whenever the connection is opened or closed trigger a project update.
- */
- protected class LocalConnectionListener
- extends ConnectionAdapter
- {
- @Override
- public void opened(ConnectionProfile profile) {
- GenericJpaDataSource.this.stateChanged();
- }
-
- @Override
- public void closed(ConnectionProfile profile) {
- GenericJpaDataSource.this.stateChanged();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java
deleted file mode 100644
index 5c44239337..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1;
-
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaFactory;
-
-/**
- * Generic JPA
- */
-public class GenericJpaFactory
- extends AbstractJpaFactory
-{
- public GenericJpaFactory() {
- super();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java
deleted file mode 100644
index 0316462b02..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java
+++ /dev/null
@@ -1,146 +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.jpa.core.internal.jpa1;
-
-import java.util.Hashtable;
-import java.util.Set;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptResourceModel;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode;
-
-/**
- * The transition between a JPA project and the resource model associated
- * with a file.
- * Hold the associated root structure nodes, which are hooks to the
- * context model.
- */
-public class GenericJpaFile
- extends AbstractJpaNode
- implements JpaFile
-{
- /**
- * typically a .java or .xml file.
- */
- protected final IFile file;
-
- /**
- * cache the content type - if the content type changes, the JPA project
- * will throw out the JPA file and build a new one
- */
- protected final IContentType contentType;
-
- /**
- * the resource model corresponding to the file
- */
- protected final JptResourceModel resourceModel;
-
- /**
- * the root structure (context model) nodes corresponding to the resource
- * model
- */
- protected final Hashtable<Object, JpaStructureNode> rootStructureNodes = new Hashtable<Object, JpaStructureNode>();
-
-
- // ********** construction **********
-
- public GenericJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JptResourceModel resourceModel) {
- super(jpaProject);
- this.file = file;
- this.contentType = contentType;
- this.resourceModel = resourceModel;
- }
-
- /**
- * Changes to {@link #ROOT_STRUCTURE_NODES_COLLECTION} do not need to trigger a
- * project update. Only the UI cares about the root structure nodes.
- * If a project update is allowed to happen, an infinite loop will result
- * if any Java class is specified in more than one location in the
- * persistence unit.
- */
- @Override
- protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
- super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
- nonUpdateAspectNames.add(ROOT_STRUCTURE_NODES_COLLECTION);
- }
-
-
- // ********** file **********
-
- public IFile getFile() {
- return this.file;
- }
-
- public IContentType getContentType() {
- return this.contentType;
- }
-
- public JptResourceModel getResourceModel() {
- return this.resourceModel;
- }
-
- public JptResourceModel getResourceModel(IContentType ct) {
- return this.contentType.isKindOf(ct) ? this.resourceModel : null;
- }
-
-
- // ********** root structure nodes **********
-
- public Iterable<JpaStructureNode> getRootStructureNodes() {
- return new LiveCloneIterable<JpaStructureNode>(this.rootStructureNodes.values());
- }
-
- public int getRootStructureNodesSize() {
- return this.rootStructureNodes.size();
- }
-
- public void addRootStructureNode(Object key, JpaStructureNode rootStructureNode) {
- JpaStructureNode old = this.rootStructureNodes.put(key, rootStructureNode);
- if (rootStructureNode != old) {
- if (old != null) {
- this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, old);
- }
- this.fireItemAdded(ROOT_STRUCTURE_NODES_COLLECTION, rootStructureNode);
- }
- }
-
- public void removeRootStructureNode(Object key, JpaStructureNode rootStructureNode) {
- if (Tools.valuesAreEqual(rootStructureNode, this.rootStructureNodes.get(key))) {
- this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, this.rootStructureNodes.remove(key));
- }
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (JpaStructureNode rootNode : this.getRootStructureNodes()) {
- JpaStructureNode node = rootNode.getStructureNode(textOffset);
- if (node != null) {
- return node;
- }
- }
- return null;
- }
-
-
- // ********** misc **********
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.file);
- sb.append('[');
- sb.append(this.contentType.getName());
- sb.append(']');
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java
deleted file mode 100644
index 2502f19457..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1;
-
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaProject;
-
-/**
- * Not much different from the abstract JPA project.
- */
-public class GenericJpaProject
- extends AbstractJpaProject
-{
-
- // ********** constructor/initialization **********
-
- public GenericJpaProject(JpaProject.Config config) {
- super(config);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java
deleted file mode 100644
index 45e59e1903..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java
+++ /dev/null
@@ -1,106 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.IdClassReference;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractEntityPrimaryKeyValidator extends
- AbstractPrimaryKeyValidator {
-
- protected AbstractEntityPrimaryKeyValidator(Entity entity,
- PrimaryKeyTextRangeResolver textRangeResolver) {
- super(entity, textRangeResolver);
- }
-
- protected Entity entity() {
- return (Entity) this.typeMapping();
- }
-
- @Override
- protected IdClassReference idClassReference() {
- return entity().getIdClassReference();
- }
-
- public boolean validate(List<IMessage> messages, IReporter reporter) {
- // if an entity is non-root, it is not allowed to define primary keys
- if (! entity().isRoot()) {
- validatePrimaryKeyForNonRoot(messages, reporter);
- }
- else {
- validatePrimaryKeyForRoot(messages, reporter);
- }
- return true;
- }
-
- protected void validatePrimaryKeyForNonRoot(List<IMessage> messages, IReporter reporter) {
- validateNonRootEntityDoesNotSpecifyIdClass(messages, reporter);
- validateNonRootEntityDoesNotSpecifyPrimaryKeyAttributes(messages, reporter);
- }
-
- protected void validatePrimaryKeyForRoot(List<IMessage> messages, IReporter reporter) {
- validatePrimaryKeyIsNotRedefined(messages, reporter);
- validateIdClassIsUsedIfNecessary(messages, reporter);
-
- // if the primary key is not defined on an ancestor, it must be defined here
- if (! definesPrimaryKey(typeMapping())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_NO_PK,
- EMPTY_STRING_ARRAY,
- entity(),
- textRangeResolver().getTypeMappingTextRange()));
- }
-
- // if primary key is composite, it may either use an id class or embedded id, not both
- validateOneOfIdClassOrEmbeddedIdIsUsed(messages, reporter);
- // ... and only one embedded id
- validateOneEmbeddedId(messages, reporter);
-
- validateMapsIdMappings(messages, reporter);
-
- if (specifiesIdClass()) {
- validateIdClass(idClassReference().getIdClass(), messages, reporter);
- }
- }
-
- protected void validateNonRootEntityDoesNotSpecifyIdClass(List<IMessage> messages, IReporter reporter) {
- if (idClassReference().isSpecified()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_NON_ROOT_ID_CLASS_SPECIFIED,
- EMPTY_STRING_ARRAY,
- entity(),
- textRangeResolver().getIdClassTextRange()));
- }
- }
-
- protected void validateNonRootEntityDoesNotSpecifyPrimaryKeyAttributes(List<IMessage> messages, IReporter reporter) {
- for (AttributeMapping each : getPrimaryKeyMappingsDefinedLocally(typeMapping())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED,
- EMPTY_STRING_ARRAY,
- each,
- textRangeResolver().getAttributeMappingTextRange(each.getName())));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java
deleted file mode 100644
index 56d9ae3421..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java
+++ /dev/null
@@ -1,42 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public abstract class AbstractJoinTableValidator
- extends AbstractTableValidator
-{
- protected AbstractJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- super(table, textRangeResolver);
- }
-
- protected AbstractJoinTableValidator(ReadOnlyPersistentAttribute persistentAttribute, ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- super(persistentAttribute, table, textRangeResolver);
- }
-
- @Override
- protected String getUnresolvedCatalogMessage() {
- return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_CATALOG;
- }
-
- @Override
- protected String getUnresolvedSchemaMessage() {
- return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_SCHEMA;
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java
deleted file mode 100644
index d4669018ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java
+++ /dev/null
@@ -1,52 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.IdClassReference;
-import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractMappedSuperclassPrimaryKeyValidator
- extends AbstractPrimaryKeyValidator
-{
- protected AbstractMappedSuperclassPrimaryKeyValidator(
- MappedSuperclass mappedSuperclass, PrimaryKeyTextRangeResolver textRangeResolver) {
-
- super(mappedSuperclass, textRangeResolver);
- }
-
-
- protected MappedSuperclass mappedSuperclass() {
- return (MappedSuperclass) this.typeMapping();
- }
-
- @Override
- protected IdClassReference idClassReference() {
- return mappedSuperclass().getIdClassReference();
- }
-
- public boolean validate(List<IMessage> messages, IReporter reporter) {
- validatePrimaryKeyIsNotRedefined(messages, reporter);
- validateIdClassIsUsedIfNecessary(messages, reporter);
-
- // if primary key is composite, it may either use an id class or embedded id, not both
- validateOneOfIdClassOrEmbeddedIdIsUsed(messages, reporter);
- // ... and only one embedded id
- validateOneEmbeddedId(messages, reporter);
-
- if (specifiesIdClass()) {
- validateIdClass(idClassReference().getIdClass(), messages, reporter);
- }
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java
deleted file mode 100644
index 6947bee1b6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java
+++ /dev/null
@@ -1,239 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractNamedColumnValidator<C extends ReadOnlyNamedColumn, R extends NamedColumnTextRangeResolver>
- implements JptValidator
-{
- /** this is <code>null</code> for columns defined on entities and secondary tables */
- protected final ReadOnlyPersistentAttribute persistentAttribute;
-
- protected final C column;
-
- protected final R textRangeResolver;
-
- protected final TableDescriptionProvider tableDescriptionProvider;
-
- protected final JptValidator tableValidator;
-
-
- 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(
- ReadOnlyPersistentAttribute persistentAttribute,
- C column,
- R textRangeResolver) {
- this(persistentAttribute, column, textRangeResolver, TableDescriptionProvider.Null.instance());
- }
-
- protected AbstractNamedColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- C column,
- R textRangeResolver,
- TableDescriptionProvider tableDescriptionProvider) {
- this.persistentAttribute = persistentAttribute;
- this.column = column;
- this.textRangeResolver = textRangeResolver;
- this.tableDescriptionProvider = tableDescriptionProvider;
- this.tableValidator = this.buildTableValidator();
- }
-
- protected JptValidator buildTableValidator() {
- return JptValidator.Null.instance();
- }
-
- public final boolean validate(List<IMessage> messages, IReporter reporter) {
- if (this.tableValidator.validate(messages, reporter)) {
- // validate the name only if the table is valid
- 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.columnIsPartOfVirtualAttribute() ?
- 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.persistentAttribute.getName(),
- this.column.getName(),
- this.column.getDbTable().getName()
- },
- this.column,
- this.textRangeResolver.getNameTextRange()
- );
- }
-
- protected abstract String getVirtualAttributeUnresolvedNameMessage();
-
- protected boolean columnIsPartOfVirtualAttribute() {
- return (this.persistentAttribute != null) &&
- this.persistentAttribute.isVirtual();
- }
-
-
- // ********** table description provider **********
-
- public interface TableDescriptionProvider {
- String getColumnTableDescriptionMessage();
-
- final class Null
- implements TableDescriptionProvider
- {
- private static final TableDescriptionProvider INSTANCE = new Null();
- public static TableDescriptionProvider instance() {
- return INSTANCE;
- }
- // ensure single instance
- private Null() {
- super();
- }
- public String getColumnTableDescriptionMessage() {
- throw new UnsupportedOperationException();
- }
- @Override
- public String toString() {
- return StringTools.buildSingletonToString(this);
- }
- }
- }
-
-
- // ********** base column table validator **********
-
- /**
- * This column table validator (or its subclasses) can only be used by
- * a validator for a <em>base</em> column, which specifies a table. This
- * includes both normal columns and join columns.
- */
- protected class BaseColumnTableValidator
- implements JptValidator
- {
- protected BaseColumnTableValidator() {
- super();
- }
-
- public boolean validate(List<IMessage> messages, IReporter reporter) {
- if (this.getColumn().tableNameIsInvalid()) {
- messages.add(this.buildTableNotValidMessage());
- return false;
- }
- return true;
- }
-
- protected ReadOnlyBaseColumn getColumn() {
- return (ReadOnlyBaseColumn) AbstractNamedColumnValidator.this.column;
- }
-
- protected IMessage buildTableNotValidMessage() {
- return AbstractNamedColumnValidator.this.columnIsPartOfVirtualAttribute() ?
- this.buildVirtualAttributeTableNotValidMessage() :
- this.buildTableNotValidMessage_();
- }
-
- protected IMessage buildTableNotValidMessage_() {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getColumnTableNotValidMessage(),
- new String[] {
- this.getColumn().getTable(),
- this.getColumn().getName(),
- this.getColumnTableDescriptionMessage()
- },
- this.getColumn(),
- this.getTextRangeResolver().getTableTextRange()
- );
- }
-
- protected String getColumnTableNotValidMessage() {
- return JpaValidationMessages.COLUMN_TABLE_NOT_VALID;
- }
-
- protected String getColumnTableDescriptionMessage() {
- return AbstractNamedColumnValidator.this.tableDescriptionProvider.getColumnTableDescriptionMessage();
- }
-
- protected BaseColumnTextRangeResolver getTextRangeResolver() {
- return (BaseColumnTextRangeResolver) AbstractNamedColumnValidator.this.textRangeResolver;
- }
-
- protected IMessage buildVirtualAttributeTableNotValidMessage() {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getVirtualAttributeColumnTableNotValidMessage(),
- new String[] {
- AbstractNamedColumnValidator.this.persistentAttribute.getName(),
- this.getColumn().getTable(),
- this.getColumn().getName(),
- this.getColumnTableDescriptionMessage()
- },
- this.getColumn(),
- this.getTextRangeResolver().getTableTextRange()
- );
- }
-
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
deleted file mode 100644
index 3cf01eabc4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java
+++ /dev/null
@@ -1,53 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractPersistentAttributeValidator
- implements JptValidator
-{
- protected ReadOnlyPersistentAttribute persistentAttribute;
-
- protected PersistentAttributeTextRangeResolver textRangeResolver;
-
-
- protected AbstractPersistentAttributeValidator(
- ReadOnlyPersistentAttribute persistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) {
- this.persistentAttribute = persistentAttribute;
- this.textRangeResolver = textRangeResolver;
- }
-
- public final boolean validate(List<IMessage> messages, IReporter reporter) {
- if (this.persistentAttribute.getMappingKey() != MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) {
- this.validateMappedAttribute(messages);
- }
- return true;
- }
-
- protected abstract void validateMappedAttribute(List<IMessage> messages);
-
- protected IMessage buildAttributeMessage(String msgID) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- msgID,
- new String[] {this.persistentAttribute.getName()},
- this.persistentAttribute,
- this.textRangeResolver.getAttributeTextRange()
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
deleted file mode 100644
index 20333cca33..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java
+++ /dev/null
@@ -1,613 +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.jpa.core.internal.jpa1.context;
-
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.HashBag;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.IdClassReference;
-import org.eclipse.jpt.jpa.core.context.IdMapping;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractPrimaryKeyValidator
- implements JptValidator
-{
- private TypeMapping typeMapping;
-
- private PrimaryKeyTextRangeResolver textRangeResolver;
-
- public static final String[] EMPTY_STRING_ARRAY = StringTools.EMPTY_STRING_ARRAY;
-
- protected AbstractPrimaryKeyValidator(
- TypeMapping typeMapping, PrimaryKeyTextRangeResolver textRangeResolver) {
-
- this.typeMapping = typeMapping;
- this.textRangeResolver = textRangeResolver;
- }
-
-
- protected TypeMapping typeMapping() {
- return this.typeMapping;
- }
-
- protected abstract IdClassReference idClassReference();
-
- protected PrimaryKeyTextRangeResolver textRangeResolver() {
- return this.textRangeResolver;
- }
-
- // for JPA portability, a hierarchy must define its primary key on one class
- // (entity *or* mapped superclass)
- protected void validatePrimaryKeyIsNotRedefined(List<IMessage> messages, IReporter reporter) {
- if (definesPrimaryKeyOnAncestor(typeMapping())) {
- if (idClassReference().isSpecified()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_PK_REDEFINED_ID_CLASS,
- EMPTY_STRING_ARRAY,
- typeMapping(),
- textRangeResolver().getIdClassTextRange()));
- }
- for (AttributeMapping each : getPrimaryKeyMappingsDefinedLocally(typeMapping())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_PK_REDEFINED_ID_ATTRIBUTE,
- EMPTY_STRING_ARRAY,
- each,
- textRangeResolver().getAttributeMappingTextRange(each.getName())));
- }
- return;
- }
- }
-
- // if a primary key defining class has multiple primary keys, it must use an id class
- protected void validateIdClassIsUsedIfNecessary(List<IMessage> messages, IReporter reporter) {
- if (! specifiesIdClass() && idClassIsRequired()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_ID_CLASS_REQUIRED,
- EMPTY_STRING_ARRAY,
- typeMapping(),
- textRangeResolver().getTypeMappingTextRange()));
- }
- }
-
- // only one composite primary key strategy may be used
- protected void validateOneOfIdClassOrEmbeddedIdIsUsed(List<IMessage> messages, IReporter reporter) {
- if (idClassReference().isSpecified()
- && CollectionTools.size(typeMapping().getAllAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)) > 0) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_ID_CLASS_AND_EMBEDDED_ID_BOTH_USED,
- EMPTY_STRING_ARRAY,
- typeMapping(),
- textRangeResolver().getTypeMappingTextRange()));
- }
- }
-
- // only one embedded id may be used
- protected void validateOneEmbeddedId(List<IMessage> messages, IReporter reporter) {
- if (CollectionTools.size(getEmbeddedIdMappings(typeMapping())) > 1) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_MULTIPLE_EMBEDDED_ID,
- EMPTY_STRING_ARRAY,
- typeMapping(),
- textRangeResolver().getTypeMappingTextRange()));
- }
- }
-
- protected void validateMapsIdMappings(List<IMessage> messages, IReporter reporter) {
- for (SingleRelationshipMapping2_0 mapsIdRelationshipMapping : getMapsIdMappingsDefinedLocally(typeMapping())) {
- // can't use maps id mappings with an id class
- if (definesIdClass(typeMapping())) {
- messages.add(DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.TYPE_MAPPING_ID_CLASS_WITH_MAPS_ID,
- new String[] {mapsIdRelationshipMapping.getName()},
- mapsIdRelationshipMapping,
- textRangeResolver().getAttributeMappingTextRange(mapsIdRelationshipMapping.getName())));
- }
-
- AttributeMapping resolvedAttributeMapping =
- mapsIdRelationshipMapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getDerivedIdAttributeMapping();
- 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>(
- idClass.getAllAttributes())) {
- 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 : typeMapping.getInheritanceHierarchy()) {
- 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 : typeMapping.getInheritanceHierarchy()) {
- 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 (TypeMapping each : typeMapping.getInheritanceHierarchy()) {
- if (each.getIdClass() != null) {
- return each.getIdClass();
- }
- }
- return null;
- }
-
-
- // **************** attribute mappings in general *************************
-
- protected Iterable<AttributeMapping> getAttributeMappings(TypeMapping typeMapping) {
- return CollectionTools.collection(typeMapping.getAllAttributeMappings());
- }
-
- /**
- * 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;
- }
- simplePrimaryKeyMappingCount++;
- if (simplePrimaryKeyMappingCount > 1) {
- return true;
- }
- }
- }
- return false;
- }
-
- protected boolean hasDerivedIdMappingMatchingIdClass(JavaPersistentType idClass) {
- for (SingleRelationshipMapping2_0 each : getDerivedIdMappings(typeMapping())) {
- String primaryKeyTypeName = getTargetEntityPrimaryKeyTypeName(each);
- if (idClass.getName().equals(primaryKeyTypeName)) {
- return true;
- }
- }
- return false;
- }
-
- protected String getTargetEntityPrimaryKeyTypeName(SingleRelationshipMapping2_0 relationshipMapping) {
- Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
- if (targetEntity != null) {
- return getPrimaryKeyTypeName(targetEntity);
- }
- return null;
- }
-
- protected String getTypeNameForIdClass(AttributeMapping attributeMapping) {
- String mappingKey = attributeMapping.getKey();
- if (CollectionTools.contains(this.getIdMappingKeys(), mappingKey)) {
- return attributeMapping.getPersistentAttribute().getTypeName();
- }
- if (CollectionTools.contains(this.getSingleRelationshipMappingKeys(), mappingKey)) {
- SingleRelationshipMapping2_0 relationshipMapping = (SingleRelationshipMapping2_0) attributeMapping;
- Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
- if (targetEntity != null) {
- return getPrimaryKeyTypeName(targetEntity);
- }
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java
deleted file mode 100644
index da999a22e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java
+++ /dev/null
@@ -1,191 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class AbstractTableValidator
- implements JptValidator
-{
- /** this is <code>null</code> for tables defined on entities */
- protected final ReadOnlyPersistentAttribute persistentAttribute;
-
- protected final ReadOnlyTable table;
-
- protected final TableTextRangeResolver textRangeResolver;
-
- protected AbstractTableValidator(
- ReadOnlyTable table,
- TableTextRangeResolver textRangeResolver) {
- this(null, table, textRangeResolver);
- }
-
- protected AbstractTableValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyTable table,
- TableTextRangeResolver textRangeResolver) {
- super();
- this.persistentAttribute = persistentAttribute;
- this.table = table;
- this.textRangeResolver = textRangeResolver;
- }
-
- protected TableTextRangeResolver getTextRangeResolver() {
- return this.textRangeResolver;
- }
-
- public boolean validate(List<IMessage> messages, IReporter reporter) {
- return this.validatesAgainstDatabase() &&
- this.validateAgainstDatabase(messages);
- }
-
- protected boolean validatesAgainstDatabase() {
- return this.table.validatesAgainstDatabase();
- }
-
- protected boolean validateAgainstDatabase(List<IMessage> messages) {
- if ( ! this.table.catalogIsResolved()) {
- messages.add(this.buildUnresolvedCatalogMessage());
- return false;
- }
-
- if ( ! this.table.schemaIsResolved()) {
- messages.add(this.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(this.buildUnresolvedNameMessage());
- }
- return false;
- }
- return true;
- }
-
- protected IMessage buildUnresolvedCatalogMessage() {
- return this.tableIsPartOfVirtualAttribute() ?
- this.buildVirtualAttributeUnresolvedCatalogMessage() :
- 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.persistentAttribute.getName(),
- this.table.getCatalog(),
- this.table.getName()
- },
- this.table,
- this.textRangeResolver.getCatalogTextRange()
- );
- }
-
- protected abstract String getVirtualAttributeUnresolvedCatalogMessage();
-
- protected IMessage buildUnresolvedSchemaMessage() {
- return this.tableIsPartOfVirtualAttribute() ?
- this.buildVirtualAttributeUnresolvedSchemaMessage() :
- 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.persistentAttribute.getName(),
- this.table.getSchema(),
- this.table.getName()
- },
- this.table,
- this.textRangeResolver.getSchemaTextRange()
- );
- }
-
- protected abstract String getVirtualAttributeUnresolvedSchemaMessage();
-
- protected IMessage buildUnresolvedNameMessage() {
- return this.tableIsPartOfVirtualAttribute() ?
- this.buildVirtualAttributeUnresolvedNameMessage() :
- 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.persistentAttribute.getName(),
- this.table.getName()
- },
- this.table,
- this.textRangeResolver.getNameTextRange()
- );
- }
-
- protected abstract String getVirtualAttributeUnresolvedNameMessage();
-
- protected boolean tableIsPartOfVirtualAttribute() {
- return (this.persistentAttribute != null) &&
- this.persistentAttribute.isVirtual();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java
deleted file mode 100644
index c38baf9152..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.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 JavaResourceType jrt;
-
- protected TypeMappingTextRangeResolver textRangeResolver;
-
-
- protected AbstractTypeMappingValidator(
- T typeMapping, JavaResourceType jrt, TypeMappingTextRangeResolver textRangeResolver) {
- this.typeMapping = typeMapping;
- this.jrt = jrt;
- 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.jrt == null) {
- return false;
- }
- return this.jrt.isMemberType();
- }
-
- protected boolean isStaticType() {
- if (this.jrt == null) {
- return false;
- }
- return this.jrt.isStatic();
- }
-
- protected boolean isFinalType() {
- if (this.jrt == null) {
- return false;
- }
- return this.jrt.isFinal();
- }
-
- protected boolean hasPrivateNoArgConstructor() {
- if (this.jrt == null) {
- return false;
- }
- return this.jrt.hasPrivateNoArgConstructor();
- }
-
- protected boolean hasNoArgConstructor() {
- if (this.jrt == null) {
- return false;
- }
- return this.jrt.hasNoArgConstructor();
- }
-
- protected IMessage buildTypeMessage(String msgID) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- msgID,
- new String[] {this.typeMapping.getName()},
- this.typeMapping,
- this.textRangeResolver.getTypeMappingTextRange()
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java
deleted file mode 100644
index d7df3d59c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java
+++ /dev/null
@@ -1,266 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class AssociationOverrideInverseJoinColumnValidator
- extends InverseJoinColumnValidator
-{
- final ReadOnlyAssociationOverride override;
-
- public AssociationOverrideInverseJoinColumnValidator(
- ReadOnlyAssociationOverride override,
- ReadOnlyJoinColumn column,
- ReadOnlyJoinColumn.Owner joinColumnOwner,
- JoinColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(column, joinColumnOwner, textRangeResolver, provider);
- this.override = override;
- }
-
- public AssociationOverrideInverseJoinColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyAssociationOverride override,
- ReadOnlyJoinColumn column,
- ReadOnlyJoinColumn.Owner joinColumnOwner,
- JoinColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
- this.override = override;
- }
-
- @Override
- protected JptValidator buildTableValidator() {
- return new TableValidator();
- }
-
- @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.persistentAttribute.getName(),
- 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
- protected 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.persistentAttribute.getName(),
- 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.persistentAttribute.getName(),
- 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.persistentAttribute.getName(),
- 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;
- }
-
-
- // ********** table validator **********
-
- public class TableValidator
- extends InverseJoinColumnValidator.TableValidator
- {
- protected TableValidator() {
- super();
- }
-
- @Override
- protected 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.getColumn().getTable(),
- this.getColumn().getName(),
- this.getColumnTableDescriptionMessage()
- },
- this.getColumn(),
- this.getTextRangeResolver().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[] {
- AssociationOverrideInverseJoinColumnValidator.this.persistentAttribute.getName(),
- AssociationOverrideInverseJoinColumnValidator.this.override.getName(),
- this.getColumn().getTable(),
- this.getColumn().getName(),
- this.getColumnTableDescriptionMessage()
- },
- this.getColumn(),
- this.getTextRangeResolver().getTableTextRange()
- );
- }
-
- @Override
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java
deleted file mode 100644
index a495440ed5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java
+++ /dev/null
@@ -1,267 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class AssociationOverrideJoinColumnValidator
- extends JoinColumnValidator
-{
- final ReadOnlyAssociationOverride override;
-
-
- public AssociationOverrideJoinColumnValidator(
- ReadOnlyAssociationOverride override,
- ReadOnlyJoinColumn column,
- ReadOnlyJoinColumn.Owner joinColumnOwner,
- JoinColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(column, joinColumnOwner, textRangeResolver, provider);
- this.override = override;
- }
-
- public AssociationOverrideJoinColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyAssociationOverride override,
- ReadOnlyJoinColumn column,
- ReadOnlyJoinColumn.Owner joinColumnOwner,
- JoinColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
- this.override = override;
- }
-
- @Override
- protected JptValidator buildTableValidator() {
- return new TableValidator();
- }
-
- @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.persistentAttribute.getName(),
- 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
- protected 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.persistentAttribute.getName(),
- 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.persistentAttribute.getName(),
- 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.persistentAttribute.getName(),
- 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;
- }
-
-
- // ********** table validator **********
-
- protected class TableValidator
- extends JoinColumnValidator.TableValidator
- {
- protected TableValidator() {
- super();
- }
-
- @Override
- protected 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.getColumn().getTable(),
- this.getColumn().getName(),
- this.getColumnTableDescriptionMessage()
- },
- this.getColumn(),
- this.getTextRangeResolver().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[] {
- AssociationOverrideJoinColumnValidator.this.persistentAttribute.getName(),
- AssociationOverrideJoinColumnValidator.this.override.getName(),
- this.getColumn().getTable(),
- this.getColumn().getName(),
- this.getColumnTableDescriptionMessage()
- },
- this.getColumn(),
- this.getTextRangeResolver().getTableTextRange()
- );
- }
-
- @Override
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java
deleted file mode 100644
index 24731b8de4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java
+++ /dev/null
@@ -1,135 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class AssociationOverrideJoinTableValidator
- extends AbstractJoinTableValidator
-{
- private final ReadOnlyAssociationOverride override;
-
- public AssociationOverrideJoinTableValidator(
- ReadOnlyAssociationOverride override,
- ReadOnlyJoinTable table,
- TableTextRangeResolver textRangeResolver) {
- super(table, textRangeResolver);
- this.override = override;
- }
-
- public AssociationOverrideJoinTableValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyAssociationOverride override,
- ReadOnlyJoinTable table,
- TableTextRangeResolver textRangeResolver) {
- super(persistentAttribute, table, textRangeResolver);
- this.override = override;
- }
-
- @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_TABLE_UNRESOLVED_NAME,
- new String[] {
- this.override.getName(),
- this.table.getName()
- },
- this.table,
- this.getTextRangeResolver().getNameTextRange()
- );
- }
-
- @Override
- protected IMessage buildUnresolvedCatalogMessage() {
- return this.override.isVirtual() ?
- this.buildVirtualOverrideUnresolvedCatalogMessage() :
- 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.table.getCatalog()
- },
- this.table,
- this.getTextRangeResolver().getCatalogTextRange()
- );
- }
-
- @Override
- protected IMessage buildUnresolvedSchemaMessage() {
- return this.override.isVirtual() ?
- this.buildVirtualOverrideUnresolvedSchemaMessage() :
- 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.table.getSchema()
- },
- this.table,
- this.getTextRangeResolver().getSchemaTextRange()
- );
- }
-
- @Override
- protected IMessage buildVirtualAttributeUnresolvedNameMessage() {
- throw this.buildNestedJoinTableNotSupportedException();
- }
-
- @Override
- protected IMessage buildVirtualAttributeUnresolvedCatalogMessage() {
- throw this.buildNestedJoinTableNotSupportedException();
- }
-
- @Override
- protected IMessage buildVirtualAttributeUnresolvedSchemaMessage() {
- throw this.buildNestedJoinTableNotSupportedException();
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedCatalogMessage() {
- throw this.buildNestedJoinTableNotSupportedException();
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedSchemaMessage() {
- throw this.buildNestedJoinTableNotSupportedException();
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- throw this.buildNestedJoinTableNotSupportedException();
- }
-
- protected UnsupportedOperationException buildNestedJoinTableNotSupportedException() {
- return new UnsupportedOperationException("A nested relationship mapping cannot specify a join table"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java
deleted file mode 100644
index b8417c6248..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java
+++ /dev/null
@@ -1,52 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class AssociationOverrideValidator
- extends OverrideValidator
-{
- public AssociationOverrideValidator(
- ReadOnlyAssociationOverride override,
- AssociationOverrideContainer container,
- OverrideTextRangeResolver textRangeResolver,
- OverrideDescriptionProvider overrideDescriptionProvider) {
- super(override, container, textRangeResolver, overrideDescriptionProvider);
- }
-
- public AssociationOverrideValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyAssociationOverride override,
- AssociationOverrideContainer container,
- OverrideTextRangeResolver textRangeResolver,
- OverrideDescriptionProvider overrideDescriptionProvider) {
- super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider);
- }
-
- @Override
- protected String getVirtualOverrideUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVALID_NAME;
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.ASSOCIATION_OVERRIDE_INVALID_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVALID_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java
deleted file mode 100644
index d5102d5f40..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java
+++ /dev/null
@@ -1,154 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class AttributeOverrideColumnValidator
- extends NamedColumnValidator
-{
- final ReadOnlyAttributeOverride override;
-
- public AttributeOverrideColumnValidator(
- ReadOnlyAttributeOverride override,
- ReadOnlyBaseColumn column,
- BaseColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider message) {
- super(column, textRangeResolver, message);
- this.override = override;
- }
-
- public AttributeOverrideColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyAttributeOverride override,
- ReadOnlyBaseColumn column,
- BaseColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider message) {
- super(persistentAttribute, column, textRangeResolver, message);
- this.override = override;
- }
-
- @Override
- protected JptValidator buildTableValidator() {
- return new TableValidator();
- }
-
- @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.persistentAttribute.getName(),
- 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;
- }
-
-
- // ********** table validator **********
-
- protected class TableValidator
- extends BaseColumnTableValidator
- {
- protected TableValidator() {
- super();
- }
-
- @Override
- protected 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.getColumn().getTable(),
- this.getColumn().getName(),
- this.getColumnTableDescriptionMessage()
- },
- this.getColumn(),
- this.getTextRangeResolver().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[] {
- AttributeOverrideColumnValidator.this.persistentAttribute.getName(),
- AttributeOverrideColumnValidator.this.override.getName(),
- this.getColumn().getTable(),
- this.getColumn().getName(),
- this.getColumnTableDescriptionMessage()
- },
- this.getColumn(),
- this.getTextRangeResolver().getTableTextRange()
- );
- }
-
- @Override
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java
deleted file mode 100644
index 7f820a41c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java
+++ /dev/null
@@ -1,52 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class AttributeOverrideValidator
- extends OverrideValidator
-{
- public AttributeOverrideValidator(
- ReadOnlyAttributeOverride override,
- AttributeOverrideContainer container,
- OverrideTextRangeResolver textRangeResolver,
- OverrideDescriptionProvider overrideDescriptionProvider) {
- super(override, container, textRangeResolver, overrideDescriptionProvider);
- }
-
- public AttributeOverrideValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyAttributeOverride override,
- AttributeOverrideContainer container,
- OverrideTextRangeResolver textRangeResolver,
- OverrideDescriptionProvider overrideDescriptionProvider) {
- super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider);
- }
-
- @Override
- protected String getVirtualOverrideUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_NAME;
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.ATTRIBUTE_OVERRIDE_INVALID_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java
deleted file mode 100644
index 5bab03af96..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java
+++ /dev/null
@@ -1,176 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class BaseJoinColumnValidator<C extends ReadOnlyBaseJoinColumn, R extends BaseJoinColumnTextRangeResolver>
- extends AbstractNamedColumnValidator<C, R>
-{
- private final ReadOnlyBaseJoinColumn.Owner joinColumnOwner;
-
- protected BaseJoinColumnValidator(
- C column,
- ReadOnlyBaseJoinColumn.Owner joinColumnOwner,
- R textRangeResolver,
- TableDescriptionProvider provider) {
- super(column, textRangeResolver, provider);
- this.joinColumnOwner = joinColumnOwner;
- }
-
- protected BaseJoinColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- C column,
- ReadOnlyBaseJoinColumn.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.getJoinColumnsSize() > 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.getJoinColumnsSize() > 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.columnIsPartOfVirtualAttribute() ?
- 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.persistentAttribute.getName(),
- this.column.getReferencedColumnName(),
- this.column.getReferencedColumnDbTable().getName()
- },
- this.column,
- this.textRangeResolver.getReferencedColumnNameTextRange()
- );
- }
-
- protected abstract String getVirtualAttributeUnresolvedReferencedColumnNameMessage();
-
- protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
- return this.columnIsPartOfVirtualAttribute() ?
- 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.persistentAttribute.getName()},
- this.column,
- this.textRangeResolver.getNameTextRange()
- );
- }
-
- protected abstract String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage();
-
- protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return this.columnIsPartOfVirtualAttribute() ?
- 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.persistentAttribute.getName()},
- this.column,
- this.textRangeResolver.getReferencedColumnNameTextRange()
- );
- }
-
- protected abstract String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java
deleted file mode 100644
index 4e0deec3dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java
+++ /dev/null
@@ -1,20 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-
-public class CollectionTableTableDescriptionProvider
- implements AbstractNamedColumnValidator.TableDescriptionProvider
-{
- public String getColumnTableDescriptionMessage() {
- return JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java
deleted file mode 100644
index c993c07889..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java
+++ /dev/null
@@ -1,34 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class DiscriminatorColumnValidator
- extends AbstractNamedColumnValidator<ReadOnlyNamedColumn, NamedColumnTextRangeResolver>
-{
- public DiscriminatorColumnValidator(
- ReadOnlyNamedColumn namedColumn,
- NamedColumnTextRangeResolver textRangeResolver) {
- super(namedColumn, textRangeResolver);
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.DISCRIMINATOR_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java
deleted file mode 100644
index 615e1c2ed0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.OverrideValidator.OverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-
-public class EmbeddableOverrideDescriptionProvider implements OverrideDescriptionProvider
-{
- public String getOverrideDescriptionMessage() {
- return JpaValidationDescriptionMessages.ON_EMBEDDABLE;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java
deleted file mode 100644
index cafc2d9552..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java
+++ /dev/null
@@ -1,44 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-
-public class EntityPrimaryKeyJoinColumnValidator
- extends PrimaryKeyJoinColumnValidator
-{
- public EntityPrimaryKeyJoinColumnValidator(
- ReadOnlyBaseJoinColumn column,
- ReadOnlyBaseJoinColumn.Owner owner,
- BaseJoinColumnTextRangeResolver textRangeResolver) {
- super(column, owner, textRangeResolver);
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java
deleted file mode 100644
index 26a00ab41d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java
+++ /dev/null
@@ -1,20 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-
-public class EntityTableDescriptionProvider
- implements AbstractNamedColumnValidator.TableDescriptionProvider
-{
- public String getColumnTableDescriptionMessage() {
- return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java
deleted file mode 100644
index 8ce6e54411..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-
-public class GenericEntityPrimaryKeyValidator
- extends AbstractEntityPrimaryKeyValidator
-{
- public GenericEntityPrimaryKeyValidator(Entity entity, PrimaryKeyTextRangeResolver textRangeResolver) {
- super(entity, textRangeResolver);
- }
-
- @Override
- protected boolean idClassIsRequired() {
- //Short circuit check for idClassIsRequired if any part of the primary key is defined
- //in a superclass for Generic types. Other validation will exist and needs to be
- //addressed first
- if(definesPrimaryKeyOnAncestor(typeMapping())){
- return false;
- }
- return super.idClassIsRequired();
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java
deleted file mode 100644
index b500925d93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
-import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver;
-
-public class GenericMappedSuperclassPrimaryKeyValidator extends
- AbstractMappedSuperclassPrimaryKeyValidator {
-
- public GenericMappedSuperclassPrimaryKeyValidator(MappedSuperclass mappedSuperclass, PrimaryKeyTextRangeResolver textRangeResolver) {
- super(mappedSuperclass, textRangeResolver);
- }
-
- @Override
- protected boolean idClassIsRequired() {
- //Short circuit check for idClassIsRequired if any part of the primary key is defined
- //in a superclass for Generic types. Other validation will exist and needs to be
- //addressed first
- if(definesPrimaryKeyOnAncestor(typeMapping())){
- return false;
- }
- return super.idClassIsRequired();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
deleted file mode 100644
index 1a6866663e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java
+++ /dev/null
@@ -1,316 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceCompilationUnit;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.HashBag;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.MappingFileRoot;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceXml2_0;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * the context model root
- */
-public class GenericRootContextNode
- extends AbstractJpaContextNode
- implements JpaRootContextNode2_0
-{
- /* This object has no parent, so it must point to the JPA project explicitly. */
- protected final JpaProject jpaProject;
-
- /* Main context object. */
- protected PersistenceXml persistenceXml;
-
-
- public GenericRootContextNode(JpaProject jpaProject) {
- super(null); // the JPA project is not really a "parent"...
-
- if (jpaProject == null) {
- throw new NullPointerException();
- }
- this.jpaProject = jpaProject;
- this.persistenceXml = this.buildPersistenceXml();
- }
-
-
- // ********** 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 PersistenceXml buildPersistenceXml() {
- JpaXmlResource xmlResource = this.resolvePersistenceXmlResource();
- return (xmlResource == null) ? null : this.buildPersistenceXml(xmlResource);
- }
-
- protected void syncPersistenceXml() {
- this.syncPersistenceXml(true);
- }
-
- /**
- * We call this method from both {@link #syncPersistenceXml()} and
- * {@link #updatePersistenceXml()} because<ul>
- * <li>a <em>sync</em> will occur when the file is edited directly;
- * and the user could modify something (e.g. the version number) that
- * triggers the file being "resolved" or not;
- * see {@link #resolvePersistenceXmlResource()}
- * <li>an <em>update</em> will occur whenever the entire file is added or
- * removed
- * </ul>
- */
- protected void syncPersistenceXml(boolean sync) {
- 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 {
- if (sync) {
- this.persistenceXml.synchronizeWithResourceModel();
- } 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;
- }
-
- /**
- * pre-condition: 'xmlResource' is not <code>null</code>
- */
- protected PersistenceXml buildPersistenceXml(JpaXmlResource xmlResource) {
- return this.getJpaFactory().buildPersistenceXml(this, xmlResource);
- }
-
- protected void updatePersistenceXml() {
- this.syncPersistenceXml(false);
- }
-
-
- // ********** misc **********
-
- @Override
- protected boolean requiresParent() {
- return false;
- }
-
- @Override
- public void stateChanged() {
- super.stateChanged();
- // forward to JPA project
- this.jpaProject.stateChanged();
- }
-
- @Override
- public JpaProject getJpaProject() {
- return this.jpaProject;
- }
-
- @Override
- public IResource getResource() {
- return this.getProject();
- }
-
- protected IProject getProject() {
- return this.jpaProject.getProject();
- }
-
- @Override
- public PersistenceUnit getPersistenceUnit() {
- return null;
- }
-
- @Override
- public MappingFileRoot getMappingFileRoot() {
- return null;
- }
-
-
- // ********** metamodel **********
-
- public void initializeMetamodel() {
- if (this.persistenceXml != null) {
- ((PersistenceXml2_0) this.persistenceXml).initializeMetamodel();
- }
- }
-
- public void synchronizeMetamodel() {
- if (this.persistenceXml != null) {
- ((PersistenceXml2_0) this.persistenceXml).synchronizeMetamodel();
- }
- }
-
- public void disposeMetamodel() {
- if (this.persistenceXml != null) {
- ((PersistenceXml2_0) this.persistenceXml).disposeMetamodel();
- }
- }
-
-
- // ********** validation **********
-
- public void validate(List<IMessage> messages, IReporter reporter) {
- if (reporter.isCancelled()) {
- throw new ValidationCancelledException();
- }
-
- if (this.persistenceXml == null) {
- messages.add(buildPersistenceXmlValidationMessage());
- return;
- }
- if ( ! this.jpaProject.discoversAnnotatedClasses()) {
- this.validateOrphanClasses(messages);
- }
- this.persistenceXml.validate(messages, reporter);
- }
-
- protected IMessage buildPersistenceXmlValidationMessage() {
- int severity = IMessage.HIGH_SEVERITY;
- IFile file = getPlatformFile();
- if (file != null && file.exists()) {
- JpaXmlResource xmlResource = this.jpaProject.getPersistenceXmlResource();
- if (xmlResource != null
- && ! getJpaPlatform().supportsResourceType(xmlResource.getResourceType())) {
- return DefaultJpaValidationMessages.buildMessage(
- severity,
- JpaValidationMessages.PERSISTENCE_XML_UNSUPPORTED_CONTENT,
- file);
- }
- return DefaultJpaValidationMessages.buildMessage(
- severity,
- JpaValidationMessages.PERSISTENCE_XML_INVALID_CONTENT,
- file);
- }
- return DefaultJpaValidationMessages.buildMessage(
- severity,
- JpaValidationMessages.PROJECT_NO_PERSISTENCE_XML,
- this);
- }
-
- protected IFile getPlatformFile() {
- return this.jpaProject.getPlatformFile(JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
- }
-
- protected void validateOrphanClasses(List<IMessage> messages) {
- Persistence persistence = this.persistenceXml.getPersistence();
- if (persistence == null) {
- return; // handled with other validation
- }
- if (persistence.getPersistenceUnitsSize() != 1) {
- return; // the context model currently only supports 1 persistence unit
- }
-
- PersistenceUnit persistenceUnit = persistence.getPersistenceUnits().iterator().next();
- HashBag<String> annotatedClassNames = CollectionTools.bag(this.jpaProject.getAnnotatedJavaSourceClassNames());
- 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) {
- JavaResourceAbstractType jrt = this.jpaProject.getJavaResourceType(orphan);
- JavaResourceCompilationUnit jrcu = jrt.getJavaResourceCompilationUnit();
- if (jrt.isAnnotatedWith(this.jpaProject.getTypeMappingAnnotations())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
- new String[] {jrt.getQualifiedName()},
- jrt.getFile(),
- jrt.getNameTextRange(jrcu.buildASTRoot())
- )
- );
- }
- else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT,
- new String[] {jrt.getName()},
- jrt.getFile(),
- jrt.getNameTextRange(jrcu.buildASTRoot())
- )
- );
- }
- }
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java
deleted file mode 100644
index 21e505ec43..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java
+++ /dev/null
@@ -1,44 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class GenericTypeMappingValidator
- extends AbstractTypeMappingValidator<TypeMapping>
-{
- public GenericTypeMappingValidator(TypeMapping typeMapping, JavaResourceType jrt, TypeMappingTextRangeResolver textRangeResolver) {
- super(typeMapping, jrt, textRangeResolver);
- }
-
- @Override
- protected void validateType(List<IMessage> messages) {
- if (this.isFinalType()) {
- messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_FINAL_CLASS));
- }
- if (this.isMemberType()) {
- messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_MEMBER_CLASS));
- }
- if (this.hasNoArgConstructor()) {
- if (this.hasPrivateNoArgConstructor()) {
- messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR));
- }
- }
- else {
- messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java
deleted file mode 100644
index a495cc48ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java
+++ /dev/null
@@ -1,103 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class InverseJoinColumnValidator
- extends BaseJoinColumnValidator<ReadOnlyJoinColumn, JoinColumnTextRangeResolver>
-{
- protected InverseJoinColumnValidator(
- ReadOnlyJoinColumn column,
- ReadOnlyJoinColumn.Owner joinColumnOwner,
- JoinColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(column, joinColumnOwner, textRangeResolver, provider);
- }
-
- public InverseJoinColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyJoinColumn column,
- ReadOnlyJoinColumn.Owner joinColumnOwner,
- JoinColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
- }
-
- @Override
- protected JptValidator buildTableValidator() {
- return new TableValidator();
- }
-
- @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;
- }
-
-
- // ********** table validator **********
-
- protected class TableValidator
- extends BaseColumnTableValidator
- {
- protected TableValidator() {
- super();
- }
-
- @Override
- protected String getColumnTableNotValidMessage() {
- return JpaValidationMessages.INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java
deleted file mode 100644
index 87ddf14046..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java
+++ /dev/null
@@ -1,103 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class JoinColumnValidator
- extends BaseJoinColumnValidator<ReadOnlyJoinColumn, JoinColumnTextRangeResolver>
-{
- protected JoinColumnValidator(
- ReadOnlyJoinColumn column,
- ReadOnlyJoinColumn.Owner joinColumnOwner,
- JoinColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(column, joinColumnOwner, textRangeResolver, provider);
- }
-
- public JoinColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyJoinColumn column,
- ReadOnlyJoinColumn.Owner joinColumnOwner,
- JoinColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider);
- }
-
- @Override
- protected JptValidator buildTableValidator() {
- return new TableValidator();
- }
-
- @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;
- }
-
-
- // ********** table validator **********
-
- protected class TableValidator
- extends BaseColumnTableValidator
- {
- protected TableValidator() {
- super();
- }
-
- @Override
- protected String getColumnTableNotValidMessage() {
- return JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java
deleted file mode 100644
index 91a0fbc3e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java
+++ /dev/null
@@ -1,20 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-
-public class JoinTableTableDescriptionProvider
- implements AbstractNamedColumnValidator.TableDescriptionProvider
-{
- public String getColumnTableDescriptionMessage() {
- return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java
deleted file mode 100644
index 982d7c16c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class JoinTableValidator
- extends AbstractJoinTableValidator
-{
- public JoinTableValidator(ReadOnlyPersistentAttribute persistentAttribute, ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- super(persistentAttribute, table, textRangeResolver);
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedCatalogMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedSchemaMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java
deleted file mode 100644
index d8679afc5e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java
+++ /dev/null
@@ -1,66 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class MapKeyAttributeOverrideColumnValidator
- extends AttributeOverrideColumnValidator
-{
- public MapKeyAttributeOverrideColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyAttributeOverride override,
- ReadOnlyBaseColumn column,
- BaseColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(persistentAttribute, override, column, textRangeResolver, provider);
- }
-
- @Override
- protected JptValidator buildTableValidator() {
- return new TableValidator();
- }
-
- @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;
- }
-
-
- // ********** table validator **********
-
- protected class TableValidator
- extends AttributeOverrideColumnValidator.TableValidator
- {
- protected TableValidator() {
- super();
- }
-
- @Override
- protected String getVirtualOverrideColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java
deleted file mode 100644
index 951bd5634b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java
+++ /dev/null
@@ -1,39 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class MapKeyAttributeOverrideValidator
- extends AttributeOverrideValidator
-{
- public MapKeyAttributeOverrideValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyAttributeOverride override,
- AttributeOverrideContainer container,
- OverrideTextRangeResolver textRangeResolver,
- OverrideDescriptionProvider overrideDescriptionProvider) {
- super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider);
- }
-
- @Override
- protected String getVirtualOverrideUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java
deleted file mode 100644
index 6ac74e6ae5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java
+++ /dev/null
@@ -1,64 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class MapKeyColumnValidator
- extends AbstractNamedColumnValidator<ReadOnlyBaseColumn, BaseColumnTextRangeResolver>
-{
- public MapKeyColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyBaseColumn column,
- BaseColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(persistentAttribute, column, textRangeResolver, provider);
- }
-
- @Override
- protected JptValidator buildTableValidator() {
- return new TableValidator();
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.MAP_KEY_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME;
- }
-
-
- // ********** table validator **********
-
- protected class TableValidator
- extends BaseColumnTableValidator
- {
- protected TableValidator() {
- super();
- }
-
- @Override
- protected String getColumnTableNotValidMessage() {
- return JpaValidationMessages.MAP_KEY_COLUMN_TABLE_NOT_VALID;
- }
-
- @Override
- protected String getVirtualAttributeColumnTableNotValidMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID;
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java
deleted file mode 100644
index 71a7dc083e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.OverrideValidator.OverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-
-public class MappedSuperclassOverrideDescriptionProvider implements OverrideDescriptionProvider
-{
- public String getOverrideDescriptionMessage() {
- return JpaValidationDescriptionMessages.ON_MAPPED_SUPERCLASS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java
deleted file mode 100644
index d75649c0a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java
+++ /dev/null
@@ -1,51 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class NamedColumnValidator
- extends AbstractNamedColumnValidator<ReadOnlyBaseColumn, BaseColumnTextRangeResolver>
-{
-
- protected NamedColumnValidator(
- ReadOnlyBaseColumn column,
- BaseColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(column, textRangeResolver, provider);
- }
-
- public NamedColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyBaseColumn column,
- BaseColumnTextRangeResolver textRangeResolver,
- TableDescriptionProvider provider) {
- super(persistentAttribute, column, textRangeResolver, provider);
- }
-
- @Override
- protected JptValidator buildTableValidator() {
- return new BaseColumnTableValidator();
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java
deleted file mode 100644
index 5f29dd78dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java
+++ /dev/null
@@ -1,47 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class OneToOnePrimaryKeyJoinColumnValidator
- extends PrimaryKeyJoinColumnValidator
-{
- public OneToOnePrimaryKeyJoinColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyBaseJoinColumn column,
- ReadOnlyBaseJoinColumn.Owner owner,
- BaseJoinColumnTextRangeResolver textRangeResolver) {
- super(persistentAttribute, column, owner, textRangeResolver);
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java
deleted file mode 100644
index 30605494ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java
+++ /dev/null
@@ -1,173 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public abstract class OverrideValidator
- implements JptValidator
-{
- /** this is <code>null</code> for overrides defined on entities */
- protected final ReadOnlyPersistentAttribute persistentAttribute;
-
- protected final ReadOnlyOverride override;
-
- protected final OverrideContainer container;
-
- protected final OverrideTextRangeResolver textRangeResolver;
-
- protected final OverrideDescriptionProvider overrideDescriptionProvider;
-
- protected OverrideValidator(
- ReadOnlyOverride override,
- OverrideContainer container,
- OverrideTextRangeResolver textRangeResolver,
- OverrideDescriptionProvider overrideDescriptionProvider) {
- this(null, override, container, textRangeResolver, overrideDescriptionProvider);
- }
-
-
- protected OverrideValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyOverride override,
- OverrideContainer container,
- OverrideTextRangeResolver textRangeResolver,
- OverrideDescriptionProvider overrideDescriptionProvider) {
- this.persistentAttribute = persistentAttribute;
- this.override = override;
- this.container = container;
- this.textRangeResolver = textRangeResolver;
- this.overrideDescriptionProvider = overrideDescriptionProvider;
- }
-
- protected String getOverrideDescriptionMessage() {
- return this.overrideDescriptionProvider.getOverrideDescriptionMessage();
- }
-
- public boolean validate(List<IMessage> messages, IReporter reporter) {
- if (this.validateType(messages)) {
- // validate the name only if the type is valid
- return this.validateName(messages);
- }
- return false;
- }
-
- protected boolean validateType(List<IMessage> messages) {
- if (this.container.getOverridableTypeMapping() == null) {
- messages.add(this.buildUnresolvedOverrideTypeMessage());
- return false;
- }
- return true;
- }
-
- protected IMessage buildUnresolvedOverrideTypeMessage() {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- this.getUnresolvedOverrideTypeMessage(),
- new String[] {this.override.getName()},
- this.override,
- this.textRangeResolver.getNameTextRange()
- );
- }
-
- protected String getUnresolvedOverrideTypeMessage() {
- return this.override.isVirtual() ?
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_TYPE :
- JpaValidationMessages.ATTRIBUTE_OVERRIDE_INVALID_TYPE;
- }
-
- protected boolean validateName(List<IMessage> messages) {
- if ( ! CollectionTools.contains(this.container.getAllOverridableNames(), this.override.getName())) {
- messages.add(this.buildUnresolvedNameMessage());
- return false;
- }
- return true;
- }
-
- protected IMessage buildUnresolvedNameMessage() {
- if (this.override.isVirtual()) {
- // this can happen when an erroneous Java override triggers a
- // corresponding orm.xml virtual override
- return this.buildVirtualUnresolvedNameMessage();
- }
- if (this.overrideIsPartOfVirtualAttribute()) {
- 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.persistentAttribute.getName(),
- this.override.getName(),
- this.getOverrideDescriptionMessage(),
- this.container.getOverridableTypeMapping().getName()
- },
- this.override,
- this.textRangeResolver.getNameTextRange()
- );
- }
-
- protected abstract String getVirtualAttributeUnresolvedNameMessage();
-
- protected boolean overrideIsPartOfVirtualAttribute() {
- return (this.persistentAttribute != null) &&
- this.persistentAttribute.isVirtual();
- }
-
- public interface OverrideDescriptionProvider {
- String getOverrideDescriptionMessage();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentFieldValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentFieldValidator.java
deleted file mode 100644
index 6d06448154..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentFieldValidator.java
+++ /dev/null
@@ -1,41 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.FieldAccessor;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class PersistentFieldValidator
- extends AbstractPersistentAttributeValidator
-{
-
- protected FieldAccessor fieldAccessor;
-
- public PersistentFieldValidator(
- ReadOnlyPersistentAttribute persistentAttribute, FieldAccessor fieldAccessor, PersistentAttributeTextRangeResolver textRangeResolver)
- {
- super(persistentAttribute, textRangeResolver);
- this.fieldAccessor = fieldAccessor;
- }
-
- @Override
- protected void validateMappedAttribute(List<IMessage> messages) {
- if (this.fieldAccessor.isFinal()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD));
- }
- if (this.fieldAccessor.isPublic()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java
deleted file mode 100644
index b4444380b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PersistentPropertyValidator.java
+++ /dev/null
@@ -1,43 +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.jpa.core.internal.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class PersistentPropertyValidator
- extends AbstractPersistentAttributeValidator
-{
-
- protected PropertyAccessor propertyAccessor;
-
- public PersistentPropertyValidator(
- ReadOnlyPersistentAttribute persistentAttribute, PropertyAccessor propertyAccessor, PersistentAttributeTextRangeResolver textRangeResolver)
- {
- super(persistentAttribute, textRangeResolver);
- this.propertyAccessor = propertyAccessor;
- }
-
- @Override
- //TODO validation for null getter or null setter - would apply to EclipseLink too
- //TODO validation for annotated setter? - would apply to EclipseLink too
- protected void validateMappedAttribute(List<IMessage> messages) {
- if (this.propertyAccessor.getResourceGetter() != null && this.propertyAccessor.getResourceGetter().isFinal()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER));
- }
- if (this.propertyAccessor.getResourceSetter() != null && this.propertyAccessor.getResourceSetter().isFinal()) {
- messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_SETTER));
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java
deleted file mode 100644
index c531b28f01..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java
+++ /dev/null
@@ -1,99 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public abstract class PrimaryKeyJoinColumnValidator
- extends BaseJoinColumnValidator<ReadOnlyBaseJoinColumn, BaseJoinColumnTextRangeResolver>
-{
- protected PrimaryKeyJoinColumnValidator(
- ReadOnlyBaseJoinColumn column,
- ReadOnlyBaseJoinColumn.Owner owner,
- BaseJoinColumnTextRangeResolver textRangeResolver) {
- super(column, owner, textRangeResolver, TableDescriptionProvider.Null.instance());
- }
-
- protected PrimaryKeyJoinColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- ReadOnlyBaseJoinColumn column,
- ReadOnlyBaseJoinColumn.Owner owner,
- BaseJoinColumnTextRangeResolver textRangeResolver) {
- super(persistentAttribute, column, owner, textRangeResolver, TableDescriptionProvider.Null.instance());
- }
-
- @Override
- protected IMessage buildUnresolvedNameMessage() {
- return this.column.isVirtual() ?
- this.buildUnresolvedNameMessage(this.getVirtualPKJoinColumnUnresolvedNameMessage()) :
- super.buildUnresolvedNameMessage();
- }
-
- protected String getVirtualPKJoinColumnUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected IMessage buildUnresolvedReferencedColumnNameMessage() {
- return this.column.isVirtual() ?
- this.buildUnresolvedReferencedColumnNameMessage(this.getVirtualPKJoinColumnUnresolvedReferencedColumnNameMessage()) :
- super.buildUnresolvedReferencedColumnNameMessage();
- }
-
- protected String getVirtualPKJoinColumnUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
- return this.column.isVirtual() ?
- this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getVirtualPKJoinColumnUnspecifiedNameMultipleJoinColumnsMessage()) :
- super.buildUnspecifiedNameMultipleJoinColumnsMessage();
- }
-
- protected String getVirtualPKJoinColumnUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return this.column.isVirtual() ?
- this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getVirtualPKJoinColumnUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage()) :
- super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
- }
-
- protected String getVirtualPKJoinColumnUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getUnresolvedReferencedColumnNameMessage() {
- return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME;
- }
-
- @Override
- protected String getUnspecifiedNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-
- @Override
- protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java
deleted file mode 100644
index 6877fdb639..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java
+++ /dev/null
@@ -1,27 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.RelationshipStrategy;
-
-public class RelationshipStrategyTableDescriptionProvider
- implements AbstractNamedColumnValidator.TableDescriptionProvider
-{
- private final RelationshipStrategy relationshipStrategy;
-
- public RelationshipStrategyTableDescriptionProvider(RelationshipStrategy relationshipStrategy) {
- super();
- this.relationshipStrategy = relationshipStrategy;
- }
-
- public String getColumnTableDescriptionMessage() {
- return this.relationshipStrategy.getColumnTableNotValidDescription();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java
deleted file mode 100644
index 7ecf62d72b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java
+++ /dev/null
@@ -1,136 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class SecondaryTablePrimaryKeyJoinColumnValidator
- extends PrimaryKeyJoinColumnValidator
-{
- private final ReadOnlySecondaryTable secondaryTable;
-
- public SecondaryTablePrimaryKeyJoinColumnValidator(
- ReadOnlySecondaryTable secondaryTable,
- ReadOnlyBaseJoinColumn column,
- ReadOnlyBaseJoinColumn.Owner owner,
- BaseJoinColumnTextRangeResolver textRangeResolver) {
- super(column, owner, textRangeResolver);
- this.secondaryTable = secondaryTable;
- }
-
- protected boolean secondaryTableIsVirtual() {
- return this.secondaryTable.isVirtual();
- }
-
- protected String getSecondaryTableName() {
- return this.secondaryTable.getName();
- }
-
- @Override
- protected IMessage buildUnresolvedNameMessage() {
- return this.secondaryTableIsVirtual() ?
- 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
- protected IMessage buildUnresolvedReferencedColumnNameMessage() {
- return this.secondaryTableIsVirtual() ?
- 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
- protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() {
- return this.secondaryTableIsVirtual() ?
- 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
- protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return this.secondaryTableIsVirtual() ?
- this.buildVirtualSecondaryTableUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() :
- super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage();
- }
-
- protected IMessage buildVirtualSecondaryTableUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS,
- new String[] {this.getSecondaryTableName()},
- this.column,
- this.textRangeResolver.getReferencedColumnNameTextRange()
- );
- }
-
- @Override
- protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java
deleted file mode 100644
index ff7cbe3139..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java
+++ /dev/null
@@ -1,56 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class SecondaryTableValidator
- extends AbstractTableValidator
-{
- public SecondaryTableValidator(ReadOnlySecondaryTable table, TableTextRangeResolver textRangeResolver) {
- super(table, textRangeResolver);
- }
-
- @Override
- protected String getUnresolvedCatalogMessage() {
- return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_CATALOG;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedCatalogMessage() {
- throw this.buildAttributeTableNotSupportedException();
- }
-
- @Override
- protected String getUnresolvedSchemaMessage() {
- return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_SCHEMA;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedSchemaMessage() {
- throw this.buildAttributeTableNotSupportedException();
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- throw this.buildAttributeTableNotSupportedException();
- }
-
- protected UnsupportedOperationException buildAttributeTableNotSupportedException() {
- return new UnsupportedOperationException("An attribute cannot specify a secondary table"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java
deleted file mode 100644
index 6a099e58b6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java
+++ /dev/null
@@ -1,56 +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.jpa.core.internal.jpa1.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-
-public class TableValidator
- extends AbstractTableValidator
-{
- public TableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- super(table, textRangeResolver);
- }
-
- @Override
- protected String getUnresolvedCatalogMessage() {
- return JpaValidationMessages.TABLE_UNRESOLVED_CATALOG;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedCatalogMessage() {
- throw this.buildAttributeTableNotSupportedException();
- }
-
- @Override
- protected String getUnresolvedSchemaMessage() {
- return JpaValidationMessages.TABLE_UNRESOLVED_SCHEMA;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedSchemaMessage() {
- throw this.buildAttributeTableNotSupportedException();
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.TABLE_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- throw this.buildAttributeTableNotSupportedException();
- }
-
- protected UnsupportedOperationException buildAttributeTableNotSupportedException() {
- return new UnsupportedOperationException("An attribute cannot specify a table"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java
deleted file mode 100644
index 3d3b4d36c5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-
-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 JavaResourceAttribute getResourceAttribute() {
- return this.getAttributeMapping().getResourceAttribute();
- }
-
- public Annotation getConverterAnnotation() {
- return this.getResourceAttribute().getAnnotation(this.getAnnotationName());
- }
-
- protected abstract String getAnnotationName();
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot);
- }
-
- protected abstract TextRange getAnnotationTextRange(CompilationUnit astRoot);
-
- public void dispose() {
- // NOP
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
deleted file mode 100644
index 1ad90725e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java
+++ /dev/null
@@ -1,593 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.NotNullFilter;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.jpa.core.context.Override_;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.VirtualOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java override container
- * <p>
- * <strong>NB:</strong> Although not typical, a Java override container can
- * correspond to only a subset of the annotations in the Java source code.
- * In that case, the index of a specified override must be translated to its
- * corresponding annotation's index before we manipulate the annotations.
- * <p>
- * As of JPA 2.0, the only place we need these translations is for the attribute
- * overrides for an embedded collection. If an embedded collection is a
- * {@link java.util.Map Map}, the attribute overrides can override the mappings
- * for either the map's keys or the map's values. The names of the overrides for
- * the map's keys are prefixed with <code>"key."</code> while the overrides
- * for the map's values are prefixed with <code>"value."</code>.
- * (Just a bit of hack, courtesy of the JPA spec committee.)
- */
-public abstract class AbstractJavaOverrideContainer<
- O extends JavaOverrideContainer.Owner,
- R extends JavaReadOnlyOverride,
- S extends JavaOverride,
- V extends JavaVirtualOverride,
- A extends OverrideAnnotation & NestableAnnotation
- >
- extends AbstractJavaJpaContextNode
- implements JavaOverrideContainer2_0
-{
- /**
- * this can be <code>null</code> if the container is "read-only"
- * (i.e. a <em>null</em> container)
- * @see #getOwner2_0()
- */
- 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;
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.synchronizeNodesWithResourceModel(this.getSpecifiedOverrides());
- // the virtual overrides do not need a sync
- }
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedOverrides();
- this.updateVirtualOverrides();
- }
-
-
- // ********** overrides **********
-
- @SuppressWarnings("unchecked")
- public ListIterable<R> getOverrides() {
- return new CompositeListIterable<R>(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides());
- }
-
- public int getOverridesSize() {
- return this.specifiedOverrides.size() + this.virtualOverrides.size();
- }
-
- public R getOverrideNamed(String name) {
- return this.selectOverrideNamed(this.getOverrides(), name);
- }
-
- public Iterable<String> getOverrideNames() {
- return new FilteringIterable<String>(this.getOverrideNames_(), NotNullFilter.<String>instance());
- }
-
- protected Iterable<String> getOverrideNames_() {
- return new TransformationIterable<R, String>(this.getOverrides()) {
- @Override
- protected String transform(R override) {
- return override.getName();
- }
- };
- }
-
-
- // ********** 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.getAllOverridableNames(), 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 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 getSpecifiedOverridesSize() {
- 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.getResourceMember().addAnnotation(annotationIndex, this.getOverrideAnnotationName());
- }
-
- 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 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.getResourceMember().removeAnnotation(annotationIndex, this.getOverrideAnnotationName());
- }
-
- 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.getResourceMember().moveAnnotation(targetAnnotationIndex, sourceAnnotationIndex, this.getOverrideAnnotationName());
- }
-
- protected abstract S buildSpecifiedOverride(A overrideAnnotation);
-
- protected void updateSpecifiedOverrides() {
- ContextContainerTools.update(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) && this.getOwner().isRelevant(overrideName);
- }
- protected JavaOverrideContainer2_0.Owner getOwner() {
- return AbstractJavaOverrideContainer.this.getOwner2_0();
- }
- };
- }
-
- protected Iterable<A> getOverrideAnnotations() {
- return new SubIterableWrapper<NestableAnnotation, A>((this.overrideAnnotations()));
- }
-
- protected Iterable<NestableAnnotation> overrideAnnotations() {
- return (this.owner == null) ? EmptyIterable.<NestableAnnotation>instance() : this.overrideAnnotations_();
- }
-
- /**
- * pre-condition: {@link #owner} is not <code>null</code>
- */
- protected Iterable<NestableAnnotation> overrideAnnotations_() {
- return this.getResourceMember().getAnnotations(this.getOverrideAnnotationName());
- }
-
- 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 ListIterable<V> getVirtualOverrides() {
- return new LiveCloneListIterable<V>(this.virtualOverrides);
- }
-
- public int getVirtualOverridesSize() {
- 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.getAllOverridableNames()) {
- @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 **********
-
- protected JavaOverrideContainer2_0.Owner getOwner2_0() {
- return (JavaOverrideContainer2_0.Owner) this.owner;
- }
-
- public TypeMapping getTypeMapping() {
- return this.owner.getTypeMapping();
- }
-
- protected JavaResourceMember getResourceMember() {
- return this.owner.getResourceMember();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return this.owner.getOverridableTypeMapping();
- }
-
- public Iterable<String> getAllOverridableNames() {
- return (this.owner != null) ? this.owner.getAllOverridableNames() : EmptyIterable.<String>instance();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.owner.tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.owner.getCandidateTableNames();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.owner.resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.owner.getDefaultTableName();
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideTextRangeResolver textRangeResolver) {
- return this.owner.buildOverrideValidator(override, this, textRangeResolver);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.owner.buildColumnValidator(override, column, columnOwner, textRangeResolver);
- }
-
- public String getPossiblePrefix() {
- return this.getOwner2_0().getPossiblePrefix();
- }
-
- public String getWritePrefix() {
- return this.getOwner2_0().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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (R override : this.getOverrides()) {
- result = override.getJavaCompletionProposals(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) {
- TextRange textRange = this.getValidationAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot);
- }
-
- protected TextRange getValidationAnnotationTextRange(CompilationUnit astRoot) {
- Annotation annotation = this.getValidationAnnotation();
- return (annotation == null) ? null : annotation.getTextRange(astRoot);
- }
-
- protected Annotation getValidationAnnotation() {
- JavaResourceMember resourceMember = this.getResourceMember();
- return resourceMember.getAnnotation(this.getOverrideAnnotationName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java
deleted file mode 100644
index bc33548424..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-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.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourcePackageFragmentRoot;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JarFile;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-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 ContextCollectionContainer<JavaPersistentType, JavaResourceType> javaPersistentTypeContainer;
-
-
- // ********** constructor/initialization **********
-
- public GenericJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) {
- super(parent);
- this.jarResourcePackageFragmentRoot = jarResourcePackageFragmentRoot;
- this.javaPersistentTypeContainer = this.buildJavaPersistentTypeContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncJavaPersistentTypes();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJavaPersistentTypes();
- }
-
- 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 Iterable<JavaPersistentType> getJavaPersistentTypes() {
- return this.javaPersistentTypeContainer.getContextElements();
- }
-
- public int getJavaPersistentTypesSize() {
- return this.javaPersistentTypeContainer.getContextElementsSize();
- }
-
- protected void syncJavaPersistentTypes() {
- this.javaPersistentTypeContainer.synchronizeWithResourceModel();
- }
-
- protected void updateJavaPersistentTypes() {
- this.javaPersistentTypeContainer.update();
- }
-
- protected void addJavaPersistentType(JavaResourceType jrt) {
- this.javaPersistentTypeContainer.addContextElement(getJavaPersistentTypesSize(), jrt);
- }
-
- protected void removeJavaPersistentType(JavaPersistentType javaPersistentType ) {
- this.javaPersistentTypeContainer.removeContextElement(javaPersistentType);
- }
-
- //only accept types, enums aren't valid for JPA
- protected Iterable<JavaResourceType> getJavaResourceTypes() {
- return new SubIterableWrapper<JavaResourceAbstractType, JavaResourceType>(
- new FilteringIterable<JavaResourceAbstractType>(this.getJavaResourceAbstractTypes()) {
- @Override
- protected boolean accept(JavaResourceAbstractType o) {
- return o.getKind() == Kind.TYPE;
- }
- });
- }
-
- /**
- * the resource JAR holds only annotated types, so we can use them all for
- * building the context types
- */
- protected Iterable<JavaResourceAbstractType> getJavaResourceAbstractTypes() {
- return this.jarResourcePackageFragmentRoot.getTypes();
- }
-
- protected JavaPersistentType buildJavaPersistentType(JavaResourceType jrt) {
- return this.getJpaFactory().buildJavaPersistentType(this, jrt);
- }
-
- protected ContextCollectionContainer<JavaPersistentType, JavaResourceType> buildJavaPersistentTypeContainer() {
- return new JavaPersistentTypeContainer();
- }
-
- /**
- * Java persistent type container
- */
- protected class JavaPersistentTypeContainer
- extends ContextCollectionContainer<JavaPersistentType, JavaResourceType>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return JAVA_PERSISTENT_TYPES_COLLECTION;
- }
- @Override
- protected JavaPersistentType buildContextElement(JavaResourceType resourceElement) {
- return GenericJarFile.this.buildJavaPersistentType(resourceElement);
- }
- @Override
- protected Iterable<JavaResourceType> getResourceElements() {
- return GenericJarFile.this.getJavaResourceTypes();
- }
- @Override
- protected JavaResourceType getResourceElement(JavaPersistentType contextElement) {
- return contextElement.getJavaResourceType();
- }
- }
-
-
- // ********** PersistentTypeContainer implementation **********
-
- public Iterable<JavaPersistentType> getPersistentTypes() {
- return this.getJavaPersistentTypes();
- }
-
-
- // ********** PersistentType.Owner implementation **********
-
- public AccessType getDefaultPersistentTypeAccess() {
- return this.getPersistenceUnit().getDefaultAccess();
- }
-
- public AccessType getOverridePersistentTypeAccess() {
- // no access type at this level overrides any local access type specification
- return null;
- }
-
-
- // ********** JpaNode implementation **********
-
- @Override
- public JarFileRef getParent() {
- return (JarFileRef) super.getParent();
- }
-
- protected JarFileRef getJarFileRef() {
- return this.getParent();
- }
-
- @Override
- public IResource getResource() {
- return this.jarResourcePackageFragmentRoot.getFile();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // TODO validate 'javaPersistentTypes'
- }
-
- public boolean isIn(org.eclipse.core.resources.IFolder folder) {
- IResource member = folder.findMember(this.jarResourcePackageFragmentRoot.getFile().getName());
- IFile file = this.jarResourcePackageFragmentRoot.getFile();
- return member != null && file != null && member.equals(file);
- }
-
- public TextRange getValidationTextRange() {
- return this.getJarFileRef().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java
deleted file mode 100644
index 55f80de86c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java
+++ /dev/null
@@ -1,144 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOverride;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverride2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Specified Java association override
- */
-public class GenericJavaAssociationOverride
- extends AbstractJavaOverride<JavaAssociationOverrideContainer, AssociationOverrideAnnotation>
- implements JavaAssociationOverride2_0
-{
- 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 **********
-
- @Override
- protected JavaAssociationOverrideContainer2_0 getContainer2_0() {
- return (JavaAssociationOverrideContainer2_0) super.getContainer2_0();
- }
-
- 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.relationship.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- @Override
- protected Iterable<String> getCandidateNames() {
- return this.getContainer().getAllOverridableNames();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.relationship.validate(messages, reporter, astRoot);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableValidator(this, table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableJoinColumnValidator(this, column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableInverseJoinColumnValidator(this, column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
deleted file mode 100644
index 215fc57d2d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java
+++ /dev/null
@@ -1,96 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-
-/**
- * Java attribute override container
- */
-public class GenericJavaAssociationOverrideContainer
- extends AbstractJavaOverrideContainer<
- JavaAssociationOverrideContainer.Owner,
- JavaReadOnlyAssociationOverride,
- JavaAssociationOverride,
- JavaVirtualAssociationOverride,
- AssociationOverrideAnnotation
- >
- implements JavaAssociationOverrideContainer2_0
-{
- public GenericJavaAssociationOverrideContainer(JavaJpaContextNode parent, JavaAssociationOverrideContainer.Owner owner) {
- super(parent, owner);
- }
-
-
- public RelationshipMapping getRelationshipMapping(String attributeName) {
- return MappingTools.getRelationshipMapping(attributeName, this.owner.getOverridableTypeMapping());
- }
-
- public ReadOnlyRelationship resolveOverriddenRelationship(String associationOverrideName) {
- return this.owner.resolveOverriddenRelationship(associationOverrideName);
- }
-
- public ReadOnlyOverrideRelationship getOverrideRelationship(String overrideName) {
- return this.getOverrideNamed(overrideName).getRelationship();
- }
-
- @Override
- protected JavaAssociationOverrideContainer2_0.Owner getOwner2_0() {
- return (JavaAssociationOverrideContainer2_0.Owner) super.getOwner2_0();
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner o, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getOwner2_0().buildJoinTableJoinColumnValidator(override, column, o, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner o, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getOwner2_0().buildJoinTableInverseJoinColumnValidator(override, column, o, textRangeResolver);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return this.getOwner2_0().buildJoinTableValidator(override, table, textRangeResolver);
- }
-
- @Override
- protected String getOverrideAnnotationName() {
- return AssociationOverrideAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected JavaAssociationOverride buildSpecifiedOverride(AssociationOverrideAnnotation overrideAnnotation) {
- return this.getJpaFactory().buildJavaAssociationOverride(this, overrideAnnotation);
- }
-
- @Override
- protected void initializeSpecifiedOverride(JavaAssociationOverride specifiedOverride, JavaVirtualAssociationOverride virtualOverride) {
- specifiedOverride.initializeFromVirtual(virtualOverride);
- }
-
- @Override
- protected JavaVirtualAssociationOverride buildVirtualOverride(String name) {
- return this.getJpaFactory().buildJavaVirtualAssociationOverride(this, name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
deleted file mode 100644
index b59988143a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java
+++ /dev/null
@@ -1,172 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOverride;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.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 String getDefaultColumnName() {
- return this.name;
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, (ReadOnlyBaseColumn) col, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
-
- public CompleteColumnAnnotation getColumnAnnotation() {
- return this.getOverrideAnnotation().getNonNullColumn();
- }
-
- public void removeColumnAnnotation() {
- this.getOverrideAnnotation().removeColumn();
- }
-
-
- // ********** derived **********
-
- protected boolean attributeIsDerivedId() {
- return this.getTypeMapping().attributeIsDerivedId(this.name);
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.column.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- @Override
- protected Iterable<String> getCandidateNames() {
- return this.getContainer().getAllOverridableNames();
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
-
- if (this.attributeIsDerivedId()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ATTRIBUTE_OVERRIDE_DERIVED_AND_SPECIFIED,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange(astRoot)
- )
- );
-
- // validate the column if it is specified
- if (this.columnAnnotationIsSpecified()) {
- this.column.validate(messages, reporter, astRoot);
- }
- } else {
- this.column.validate(messages, reporter, astRoot);
- }
- }
-
- protected boolean columnAnnotationIsSpecified() {
- return this.getOverrideAnnotation().getColumn() != null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
deleted file mode 100644
index 182d70f4aa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java
+++ /dev/null
@@ -1,66 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-
-/**
- * Java attribute override container
- */
-public class GenericJavaAttributeOverrideContainer
- extends AbstractJavaOverrideContainer<
- JavaAttributeOverrideContainer.Owner,
- JavaReadOnlyAttributeOverride,
- JavaAttributeOverride,
- JavaVirtualAttributeOverride,
- AttributeOverrideAnnotation
- >
- implements JavaAttributeOverrideContainer2_0
-{
- public GenericJavaAttributeOverrideContainer(JavaJpaContextNode parent, JavaAttributeOverrideContainer.Owner owner) {
- super(parent, owner);
- }
-
-
- public ReadOnlyColumn resolveOverriddenColumn(String attributeName) {
- return (attributeName == null) ? null : this.owner.resolveOverriddenColumn(attributeName);
- }
-
- public ReadOnlyColumn getOverrideColumn(String overrideName) {
- return this.getOverrideNamed(overrideName).getColumn();
- }
-
- @Override
- protected String getOverrideAnnotationName() {
- return AttributeOverrideAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected JavaAttributeOverride buildSpecifiedOverride(AttributeOverrideAnnotation overrideAnnotation) {
- return this.getJpaFactory().buildJavaAttributeOverride(this, overrideAnnotation);
- }
-
- @Override
- protected void initializeSpecifiedOverride(JavaAttributeOverride specifiedOverride, JavaVirtualAttributeOverride virtualOverride) {
- specifiedOverride.initializeFromVirtual(virtualOverride);
- }
-
- @Override
- protected JavaVirtualAttributeOverride buildVirtualOverride(String name) {
- return this.getJpaFactory().buildJavaVirtualAttributeOverride(this, name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java
deleted file mode 100644
index fc88aeed80..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBasicMapping;
-
-public class GenericJavaBasicMapping
- extends AbstractJavaBasicMapping
-{
- public GenericJavaBasicMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java
deleted file mode 100644
index 604aea968a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java
+++ /dev/null
@@ -1,260 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaRelationshipMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCascade2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation;
-
-public class GenericJavaCascade
- extends AbstractJavaJpaContextNode
- implements JavaCascade2_0
-{
- protected boolean all;
-
- protected boolean persist;
-
- protected boolean merge;
-
- protected boolean remove;
-
- protected boolean refresh;
-
- /* JPA 2.0 */
- protected boolean detach;
-
-
- /**
- * This is built directly by the mapping implementation; as opposed to via
- * a platform-specific factory.
- * @see AbstractJavaRelationshipMapping#buildCascade()
- */
- public GenericJavaCascade(JavaRelationshipMapping parent) {
- super(parent);
- this.all = this.buildAll();
- this.persist = this.buildPersist();
- this.merge = this.buildMerge();
- this.remove = this.buildRemove();
- this.refresh = this.buildRefresh();
- this.detach = this.buildDetach();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setAll_(this.buildAll());
- this.setPersist_(this.buildPersist());
- this.setMerge_(this.buildMerge());
- this.setRemove_(this.buildRemove());
- this.setRefresh_(this.buildRefresh());
- this.setDetach_(this.buildDetach());
- }
-
-
- // ********** all **********
-
- public boolean isAll() {
- return this.all;
- }
-
- public void setAll(boolean all) {
- if (all != this.all) {
- this.getMappingAnnotationForUpdate().setCascadeAll(all);
- this.setAll_(all);
- }
- }
-
- protected void setAll_(boolean all) {
- boolean old = this.all;
- this.all = all;
- this.firePropertyChanged(ALL_PROPERTY, old, all);
- }
-
- protected boolean buildAll() {
- RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
- return (annotation != null) && annotation.isCascadeAll();
- }
-
-
- // ********** persist **********
-
- public boolean isPersist() {
- return this.persist;
- }
-
- public void setPersist(boolean persist) {
- if (persist != this.persist) {
- this.getMappingAnnotationForUpdate().setCascadePersist(persist);
- this.setPersist_(persist);
- }
- }
-
- protected void setPersist_(boolean persist) {
- boolean old = this.persist;
- this.persist = persist;
- this.firePropertyChanged(PERSIST_PROPERTY, old, persist);
- }
-
- protected boolean buildPersist() {
- RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
- return (annotation != null) && annotation.isCascadePersist();
- }
-
-
- // ********** merge **********
-
- public boolean isMerge() {
- return this.merge;
- }
-
- public void setMerge(boolean merge) {
- if (merge != this.merge) {
- this.getMappingAnnotationForUpdate().setCascadeMerge(merge);
- this.setMerge_(merge);
- }
- }
-
- protected void setMerge_(boolean merge) {
- boolean old = this.merge;
- this.merge = merge;
- this.firePropertyChanged(MERGE_PROPERTY, old, merge);
- }
-
- protected boolean buildMerge() {
- RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
- return (annotation != null) && annotation.isCascadeMerge();
- }
-
-
- // ********** remove **********
-
- public boolean isRemove() {
- return this.remove;
- }
-
- public void setRemove(boolean remove) {
- if (remove != this.remove) {
- this.getMappingAnnotationForUpdate().setCascadeRemove(remove);
- this.setRemove_(remove);
- }
- }
-
- protected void setRemove_(boolean remove) {
- boolean oldRemove = this.remove;
- this.remove = remove;
- this.firePropertyChanged(REMOVE_PROPERTY, oldRemove, remove);
- }
-
- protected boolean buildRemove() {
- RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
- return (annotation != null) && annotation.isCascadeRemove();
- }
-
-
- // ********** refresh **********
-
- public boolean isRefresh() {
- return this.refresh;
- }
-
- public void setRefresh(boolean refresh) {
- if (refresh != this.refresh) {
- this.getMappingAnnotationForUpdate().setCascadeRefresh(refresh);
- this.setRefresh_(refresh);
- }
- }
-
- protected void setRefresh_(boolean refresh) {
- boolean old = this.refresh;
- this.refresh = refresh;
- this.firePropertyChanged(REFRESH_PROPERTY, old, refresh);
- }
-
- protected boolean buildRefresh() {
- RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
- return (annotation != null) && annotation.isCascadeRefresh();
- }
-
-
- // ********** detach **********
-
- public boolean isDetach() {
- return this.detach;
- }
-
- public void setDetach(boolean detach) {
- if (detach != this.detach) {
- this.getMappingAnnotationForUpdate2_0().setCascadeDetach(detach);
- this.setDetach_(detach);
- }
- }
-
- protected void setDetach_(boolean detach) {
- boolean old = this.detach;
- this.detach = detach;
- this.firePropertyChanged(DETACH_PROPERTY, old, detach);
- }
-
- protected boolean buildDetach() {
- return this.isJpa2_0Compatible() && this.buildDetach_();
- }
-
- protected boolean buildDetach_() {
- RelationshipMapping2_0Annotation annotation = this.getMappingAnnotation2_0();
- return (annotation != null) && annotation.isCascadeDetach();
- }
-
-
-
- // ********** misc **********
-
- @Override
- public JavaRelationshipMapping getParent() {
- return (JavaRelationshipMapping) super.getParent();
- }
-
- protected JavaRelationshipMapping getMapping() {
- return this.getParent();
- }
-
- protected RelationshipMappingAnnotation getMappingAnnotation() {
- return this.getMapping().getMappingAnnotation();
- }
-
- protected RelationshipMappingAnnotation getMappingAnnotationForUpdate() {
- return this.getMapping().getAnnotationForUpdate();
- }
-
- protected RelationshipMapping2_0Annotation getMappingAnnotation2_0() {
- return (RelationshipMapping2_0Annotation) this.getMappingAnnotation();
- }
-
- protected RelationshipMapping2_0Annotation getMappingAnnotationForUpdate2_0() {
- return (RelationshipMapping2_0Annotation) this.getMappingAnnotationForUpdate();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getAnnotationCascadeTextRange(astRoot);
- return (textRange != null) ? textRange : this.getMapping().getValidationTextRange(astRoot);
- }
-
- protected TextRange getAnnotationCascadeTextRange(CompilationUnit astRoot) {
- RelationshipMappingAnnotation annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getCascadeTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java
deleted file mode 100644
index 2af11ca6fa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseColumn;
-import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
-
-/**
- * Java column
- * <p>
- * Note: The <code>Column</code> annotation is one of only 2 annotations that
- * can be nested outside of an array (i.e. in an <code>AttributeOverride</code>
- * annotation); the other is {@link GenericJavaJoinTable JoinTable}.
- */
-public class GenericJavaColumn
- extends AbstractJavaBaseColumn<CompleteColumnAnnotation, JavaColumn.Owner>
- implements JavaColumn
-{
- protected Integer specifiedLength;
- protected int defaultLength;
-
- protected Integer specifiedPrecision;
- protected int defaultPrecision;
-
- protected Integer specifiedScale;
- protected int defaultScale;
-
-
- public GenericJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) {
- super(parent, owner);
- this.specifiedLength = this.buildSpecifiedLength();
- this.specifiedPrecision = this.buildSpecifiedPrecision();
- this.specifiedScale = this.buildSpecifiedScale();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedLength_(this.buildSpecifiedLength());
- this.setSpecifiedPrecision_(this.buildSpecifiedPrecision());
- this.setSpecifiedScale_(this.buildSpecifiedScale());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultLength(this.buildDefaultLength());
- this.setDefaultPrecision(this.buildDefaultPrecision());
- this.setDefaultScale(this.buildDefaultScale());
- }
-
-
- // ********** column annotation **********
-
- @Override
- public CompleteColumnAnnotation getColumnAnnotation() {
- return this.owner.getColumnAnnotation();
- }
-
- @Override
- protected void removeColumnAnnotation() {
- this.owner.removeColumnAnnotation();
- }
-
-
- // ********** length **********
-
- public int getLength() {
- return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer length) {
- if (this.valuesAreDifferent(this.specifiedLength, length)) {
- this.getColumnAnnotation().setLength(length);
- this.removeColumnAnnotationIfUnset();
- this.setSpecifiedLength_(length);
- }
- }
-
- protected void setSpecifiedLength_(Integer length) {
- Integer old = this.specifiedLength;
- this.specifiedLength = length;
- this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
- }
-
- protected Integer buildSpecifiedLength() {
- return this.getColumnAnnotation().getLength();
- }
-
- public int getDefaultLength() {
- return this.defaultLength;
- }
-
- protected void setDefaultLength(int length) {
- int old = this.defaultLength;
- this.defaultLength = length;
- this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length);
- }
-
- protected int buildDefaultLength() {
- return DEFAULT_LENGTH;
- }
-
-
- // ********** precision **********
-
- public int getPrecision() {
- return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision;
- }
-
- public Integer getSpecifiedPrecision() {
- return this.specifiedPrecision;
- }
-
- public void setSpecifiedPrecision(Integer precision) {
- if (this.valuesAreDifferent(this.specifiedPrecision, precision)) {
- this.getColumnAnnotation().setPrecision(precision);
- this.removeColumnAnnotationIfUnset();
- this.setSpecifiedPrecision_(precision);
- }
- }
-
- protected void setSpecifiedPrecision_(Integer precision) {
- Integer old = this.specifiedPrecision;
- this.specifiedPrecision = precision;
- this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
- }
-
- protected Integer buildSpecifiedPrecision() {
- return this.getColumnAnnotation().getPrecision();
- }
-
- public int getDefaultPrecision() {
- return this.defaultPrecision;
- }
-
- protected void setDefaultPrecision(int precision) {
- int old = this.defaultPrecision;
- this.defaultPrecision = precision;
- this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision);
- }
-
- protected int buildDefaultPrecision() {
- return DEFAULT_PRECISION;
- }
-
-
- // ********** scale **********
-
- public int getScale() {
- return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale;
- }
-
- public Integer getSpecifiedScale() {
- return this.specifiedScale;
- }
-
- public void setSpecifiedScale(Integer scale) {
- if (this.valuesAreDifferent(this.specifiedScale, scale)) {
- this.getColumnAnnotation().setScale(scale);
- this.removeColumnAnnotationIfUnset();
- this.setSpecifiedScale_(scale);
- }
- }
-
- protected void setSpecifiedScale_(Integer scale) {
- Integer old = this.specifiedScale;
- this.specifiedScale = scale;
- this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
- }
-
- protected Integer buildSpecifiedScale() {
- return this.getColumnAnnotation().getScale();
- }
-
- public int getDefaultScale() {
- return this.defaultScale;
- }
-
- protected void setDefaultScale(int scale) {
- int old = this.defaultScale;
- this.defaultScale = scale;
- this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale);
- }
-
- protected int buildDefaultScale() {
- return DEFAULT_SCALE;
- }
-
-
- // ********** misc **********
-
- public void initializeFrom(ReadOnlyColumn oldColumn) {
- super.initializeFrom(oldColumn);
- this.setSpecifiedLength(oldColumn.getSpecifiedLength());
- this.setSpecifiedPrecision(oldColumn.getSpecifiedPrecision());
- this.setSpecifiedScale(oldColumn.getSpecifiedScale());
- }
-
- public void initializeFromVirtual(ReadOnlyColumn virtualColumn) {
- super.initializeFromVirtual(virtualColumn);
- // ignore other settings?
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
deleted file mode 100644
index 5cf6eac93c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java
+++ /dev/null
@@ -1,182 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
-import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-
-/**
- * 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.getJavaResourceType().getNonNullAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected void removeColumnAnnotation() {
- this.getJavaResourceType().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 JavaResourceType getJavaResourceType() {
- return this.getPersistentType().getJavaResourceType();
- }
-
-
- // ********** validation **********
-
- public boolean isResourceSpecified() {
- return this.getColumnAnnotation().isSpecified();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java
deleted file mode 100644
index 75bcc8579a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddable;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-
-/**
- * Java embeddable type mapping
- */
-public class GenericJavaEmbeddable
- extends AbstractJavaEmbeddable
-{
- public GenericJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) {
- super(parent, mappingAnnotation);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- //generic only allows basic and transient within an Embeddable
- return ArrayTools.contains(ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-
- public static final String[] ALLOWED_ATTRIBUTE_MAPPING_KEYS =
- new String[] {
- MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
deleted file mode 100644
index f77e44ff23..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java
+++ /dev/null
@@ -1,145 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedIdMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java embedded ID mapping
- */
-public class GenericJavaEmbeddedIdMapping
- extends AbstractJavaBaseEmbeddedMapping<EmbeddedIdAnnotation>
- implements EmbeddedIdMapping2_0, JavaEmbeddedIdMapping
-{
- /* JPA 2.0 - the embedded id may be derived from a relationship */
- protected boolean derived;
-
-
- public GenericJavaEmbeddedIdMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.setDerived(this.buildDerived());
- }
-
-
- // ********** derived **********
-
- public boolean isDerived() {
- return this.derived;
- }
-
- protected void setDerived(boolean derived) {
- boolean old = this.derived;
- this.derived = derived;
- this.firePropertyChanged(DERIVED_PROPERTY, old, derived);
- }
-
- protected boolean buildDerived() {
- return this.isJpa2_0Compatible() && this.buildDerived_();
- }
-
- protected boolean buildDerived_() {
- return this.getTypeMapping().attributeIsDerivedId(this.getName());
- }
-
-
- // ********** misc **********
-
- public String getKey() {
- return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected String getAnnotationName() {
- return EmbeddedIdAnnotation.ANNOTATION_NAME;
- }
-
- @Override
- protected Iterable<String> getEmbeddableOverridableAttributeMappingNames() {
- return (this.derived) ?
- EmptyIterable.<String>instance() :
- super.getEmbeddableOverridableAttributeMappingNames();
- }
-
- @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.derived
- && (this.attributeOverrideContainer.getSpecifiedOverridesSize() > 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 Iterable<String> getAllOverridableNames() {
- return GenericJavaEmbeddedIdMapping.this.isDerived() ?
- EmptyIterable.<String>instance() :
- super.getAllOverridableNames();
- }
-
- @Override
- protected Iterable<String> getAllOverridableAttributeNames_(TypeMapping overriddenTypeMapping) {
- return new FilteringIterable<String>(super.getAllOverridableAttributeNames_(overriddenTypeMapping)) {
- @Override
- protected boolean accept(String attributeName) {
- return ! AttributeOverrideContainerOwner.this.getTypeMapping().attributeIsDerivedId(attributeName);
- }
- };
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
deleted file mode 100644
index 80c6ec58a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java
+++ /dev/null
@@ -1,303 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AssociationOverride;
-import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-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 Iterable<String> getAllMappingNames() {
- return this.isJpa2_0Compatible() ?
- new CompositeIterable<String>(super.getAllMappingNames(), this.getAllEmbeddableAttributeMappingNames()) :
- super.getAllMappingNames();
- }
-
- protected Iterable<String> getAllEmbeddableAttributeMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(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 : this.getEmbeddableAttributeMappings()) {
- 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);
- }
-
- @Override
- protected JavaAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() {
- return new AttributeOverrideContainerOwner();
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- result = this.associationOverrideContainer.getJavaCompletionProposals(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);
- }
-
-
- // ********** attribute override container owner *********
-
- protected class AttributeOverrideContainerOwner
- extends AbstractJavaBaseEmbeddedMapping<EmbeddedAnnotation>.AttributeOverrideContainerOwner
- {
- // nothing yet
- }
-
-
- // ********** association override container owner **********
-
- protected class AssociationOverrideContainerOwner
- implements JavaAssociationOverrideContainer2_0.Owner
- {
- public JavaResourceAttribute getResourceMember() {
- return GenericJavaEmbeddedMapping.this.getResourceAttribute();
- }
-
- public TypeMapping getTypeMapping() {
- return GenericJavaEmbeddedMapping.this.getTypeMapping();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return GenericJavaEmbeddedMapping.this.getTargetEmbeddable();
- }
-
- public Iterable<String> getAllOverridableNames() {
- TypeMapping typeMapping = this.getOverridableTypeMapping();
- return (typeMapping != null) ? typeMapping.getAllOverridableAssociationNames() : EmptyIterable.<String>instance();
- }
-
- public Relationship resolveOverriddenRelationship(String attributeName) {
- return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getTypeMapping().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getTypeMapping().getPrimaryTableName();
- }
-
- public String getPossiblePrefix() {
- return null;
- }
-
- public String getWritePrefix() {
- return null;
- }
-
- // no maps, so all overrides are relevant
- public boolean isRelevant(String overrideName) {
- return true;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaEmbeddedMapping.this.getValidationTextRange(astRoot);
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AssociationOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyAssociationOverride) override, (ReadOnlyJoinColumn) column, (ReadOnlyJoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideInverseJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinTableValidator(this.getPersistentAttribute(), override, (ReadOnlyJoinTable) table, textRangeResolver);
- }
-
- protected JavaPersistentAttribute getPersistentAttribute() {
- return GenericJavaEmbeddedMapping.this.getPersistentAttribute();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java
deleted file mode 100644
index e123367631..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEntity;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-
-public class GenericJavaEntity
- extends AbstractJavaEntity
-{
- // EclipseLink holds its cacheable in its caching
- protected final JavaCacheable2_0 cacheable;
-
-
- public GenericJavaEntity(JavaPersistentType parent, EntityAnnotation mappingAnnotation) {
- super(parent, mappingAnnotation);
- this.cacheable = this.buildCacheable();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.cacheable.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.cacheable.update();
- }
-
-
- // ********** cacheable **********
-
- public JavaCacheable2_0 getCacheable() {
- return this.cacheable;
- }
-
- protected JavaCacheable2_0 buildCacheable() {
- return this.isJpa2_0Compatible() ?
- this.getJpaFactory2_0().buildJavaCacheable(this) :
- new NullJavaCacheable2_0(this);
- }
-
- public boolean calculateDefaultCacheable() {
- Cacheable2_0 parentCacheable = this.getParentCacheable();
- return (parentCacheable != null) ?
- parentCacheable.isCacheable() :
- ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable();
- }
-
- protected Cacheable2_0 getParentCacheable() {
- CacheableHolder2_0 parentEntity = (CacheableHolder2_0) this.getParentEntity();
- return (parentEntity == null) ? null : parentEntity.getCacheable();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java
deleted file mode 100644
index 47336cfb95..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java
+++ /dev/null
@@ -1,111 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.EnumType;
-import org.eclipse.jpt.jpa.core.context.EnumeratedConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-
-public class GenericJavaEnumeratedConverter
- extends AbstractJavaConverter
- implements JavaEnumeratedConverter
-{
- protected final EnumeratedAnnotation enumeratedAnnotation;
-
- protected EnumType specifiedEnumType;
- protected EnumType defaultEnumType;
-
-
- public GenericJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation enumeratedAnnotation) {
- super(parent);
- this.enumeratedAnnotation = enumeratedAnnotation;
- this.specifiedEnumType = this.buildSpecifiedEnumType();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedEnumType_(this.buildSpecifiedEnumType());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultEnumType(this.buildDefaultEnumType());
- }
-
-
- // ********** enum type **********
-
- public EnumType getEnumType() {
- return (this.specifiedEnumType != null) ? this.specifiedEnumType : this.defaultEnumType;
- }
-
- public EnumType getSpecifiedEnumType() {
- return this.specifiedEnumType;
- }
-
- public void setSpecifiedEnumType(EnumType enumType) {
- this.enumeratedAnnotation.setValue(EnumType.toJavaResourceModel(enumType));
- this.setSpecifiedEnumType_(enumType);
- }
-
- protected void setSpecifiedEnumType_(EnumType enumType) {
- EnumType old = this.specifiedEnumType;
- this.specifiedEnumType = enumType;
- this.firePropertyChanged(SPECIFIED_ENUM_TYPE_PROPERTY, old, enumType);
- }
-
- protected EnumType buildSpecifiedEnumType() {
- return EnumType.fromJavaResourceModel(this.enumeratedAnnotation.getValue());
- }
-
- public EnumType getDefaultEnumType() {
- return this.defaultEnumType;
- }
-
- protected void setDefaultEnumType(EnumType enumType) {
- EnumType old = this.defaultEnumType;
- this.defaultEnumType = enumType;
- this.firePropertyChanged(DEFAULT_ENUM_TYPE_PROPERTY, old, enumType);
- }
-
- protected EnumType buildDefaultEnumType() {
- return DEFAULT_ENUM_TYPE;
- }
-
-
- // ********** misc **********
-
- public Class<? extends Converter> getType() {
- return EnumeratedConverter.class;
- }
-
- @Override
- protected String getAnnotationName() {
- return EnumeratedAnnotation.ANNOTATION_NAME;
- }
-
-
- // ********** validation **********
-
- @Override
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- return this.enumeratedAnnotation.getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
deleted file mode 100644
index 6e91d7e198..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java
+++ /dev/null
@@ -1,233 +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.jpa.core.internal.jpa1.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.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.GenerationType;
-import org.eclipse.jpt.jpa.core.context.Generator;
-import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java generated value
- */
-public class GenericJavaGeneratedValue
- extends AbstractJavaJpaContextNode
- implements JavaGeneratedValue
-{
- protected final GeneratedValueAnnotation generatedValueAnnotation;
-
- protected GenerationType specifiedStrategy;
- protected GenerationType defaultStrategy;
-
- protected String specifiedGenerator;
- protected String defaultGenerator;
-
-
- public GenericJavaGeneratedValue(JavaIdMapping parent, GeneratedValueAnnotation generatedValueAnnotation) {
- super(parent);
- this.generatedValueAnnotation = generatedValueAnnotation;
- this.specifiedStrategy = this.buildSpecifiedStrategy();
- this.specifiedGenerator = generatedValueAnnotation.getGenerator();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedStrategy_(this.buildSpecifiedStrategy());
- this.setSpecifiedGenerator_(this.generatedValueAnnotation.getGenerator());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultStrategy(this.buildDefaultStrategy());
- this.setDefaultGenerator(this.buildDefaultGenerator());
- }
-
-
- // ********** strategy **********
-
- public GenerationType getStrategy() {
- return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.defaultStrategy;
- }
-
- public GenerationType getSpecifiedStrategy() {
- return this.specifiedStrategy;
- }
-
- public void setSpecifiedStrategy(GenerationType strategy) {
- this.generatedValueAnnotation.setStrategy(GenerationType.toJavaResourceModel(strategy));
- this.setSpecifiedStrategy_(strategy);
- }
-
- protected void setSpecifiedStrategy_(GenerationType strategy) {
- GenerationType old = this.specifiedStrategy;
- this.specifiedStrategy = strategy;
- this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
- }
-
- protected GenerationType buildSpecifiedStrategy() {
- return GenerationType.fromJavaResourceModel(this.generatedValueAnnotation.getStrategy());
- }
-
- public GenerationType getDefaultStrategy() {
- return this.defaultStrategy;
- }
-
- protected void setDefaultStrategy(GenerationType strategy) {
- GenerationType old = this.defaultStrategy;
- this.defaultStrategy = strategy;
- this.firePropertyChanged(DEFAULT_STRATEGY_PROPERTY, old, strategy);
- }
-
- protected GenerationType buildDefaultStrategy() {
- return DEFAULT_STRATEGY;
- }
-
-
- // ********** generator **********
-
- public String getGenerator() {
- return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator;
- }
-
- public String getSpecifiedGenerator() {
- return this.specifiedGenerator;
- }
-
- public void setSpecifiedGenerator(String generator) {
- this.generatedValueAnnotation.setGenerator(generator);
- this.setSpecifiedGenerator_(generator);
- }
-
- protected void setSpecifiedGenerator_(String generator) {
- String old = this.specifiedGenerator;
- this.specifiedGenerator = generator;
- this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
- }
-
- public String getDefaultGenerator() {
- return this.defaultGenerator;
- }
-
- protected void setDefaultGenerator(String generator) {
- String old = this.defaultGenerator;
- this.defaultGenerator = generator;
- this.firePropertyChanged(DEFAULT_GENERATOR_PROPERTY, old, generator);
- }
-
- protected String buildDefaultGenerator() {
- return null;
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaIdMapping getParent() {
- return (JavaIdMapping) super.getParent();
- }
-
- protected JavaIdMapping getIdMapping() {
- return this.getParent();
- }
-
- public GeneratedValueAnnotation getGeneratedValueAnnotation() {
- return this.generatedValueAnnotation;
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.generatorTouches(pos, astRoot)) {
- return this.getJavaCandidateGeneratorNames(filter);
- }
- return null;
- }
-
- protected boolean generatorTouches(int pos, CompilationUnit astRoot) {
- return this.generatedValueAnnotation.generatorTouches(pos, astRoot);
- }
-
- protected Iterable<String> getJavaCandidateGeneratorNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateGeneratorNames(filter));
- }
-
- protected Iterable<String> getCandidateGeneratorNames(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateGeneratorNames(), filter);
- }
-
- protected Iterable<String> getCandidateGeneratorNames() {
- return this.getPersistenceUnit().getUniqueGeneratorNames();
- }
-
-
- // ********** 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 (Generator next : this.getPersistenceUnit().getGenerators()) {
- if (generator.equals(next.getName())) {
- return;
- }
- }
-
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME,
- new String[] {generator},
- this.getIdMapping(),
- this.getGeneratorTextRange(astRoot)
- )
- );
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getIdMapping().getValidationTextRange(astRoot);
- }
-
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- return this.generatedValueAnnotation.getTextRange(astRoot);
- }
-
- public TextRange getGeneratorTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.generatedValueAnnotation.getGeneratorTextRange(astRoot), astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java
deleted file mode 100644
index 9b330f4e25..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java
+++ /dev/null
@@ -1,260 +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.jpa.core.internal.jpa1.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.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaGeneratorContainer
- extends AbstractJavaJpaContextNode
- implements JavaGeneratorContainer
-{
- protected final Owner owner;
-
- protected JavaSequenceGenerator sequenceGenerator;
-
- protected JavaTableGenerator tableGenerator;
-
-
- public GenericJavaGeneratorContainer(JavaJpaContextNode parent, Owner owner) {
- super(parent);
- this.owner = owner;
- this.sequenceGenerator = this.buildSequenceGenerator();
- this.tableGenerator = this.buildTableGenerator();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSequenceGenerator();
- this.syncTableGenerator();
- }
-
- @Override
- public void update() {
- super.update();
- if (this.sequenceGenerator != null) {
- this.sequenceGenerator.update();
- }
- if (this.tableGenerator != null) {
- this.tableGenerator.update();
- }
- }
-
-
- // ********** sequence generator **********
-
- public JavaSequenceGenerator getSequenceGenerator() {
- return this.sequenceGenerator;
- }
-
- public JavaSequenceGenerator addSequenceGenerator() {
- if (this.sequenceGenerator != null) {
- throw new IllegalStateException("sequence generator already exists: " + this.sequenceGenerator); //$NON-NLS-1$
- }
- SequenceGeneratorAnnotation annotation = this.buildSequenceGeneratorAnnotation();
- JavaSequenceGenerator generator = this.buildSequenceGenerator(annotation);
- this.setSequenceGenerator(generator);
- return generator;
- }
-
- protected SequenceGeneratorAnnotation buildSequenceGeneratorAnnotation() {
- return (SequenceGeneratorAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
- }
-
- public void removeSequenceGenerator() {
- if (this.sequenceGenerator == null) {
- throw new IllegalStateException("sequence generator does not exist"); //$NON-NLS-1$
- }
- this.owner.getResourceAnnotatedElement().removeAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
- this.setSequenceGenerator(null);
- }
-
- protected JavaSequenceGenerator buildSequenceGenerator() {
- SequenceGeneratorAnnotation annotation = this.getSequenceGeneratorAnnotation();
- return (annotation == null) ? null : this.buildSequenceGenerator(annotation);
- }
-
- protected SequenceGeneratorAnnotation getSequenceGeneratorAnnotation() {
- return (SequenceGeneratorAnnotation) this.owner.getResourceAnnotatedElement().getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME);
- }
-
- protected JavaSequenceGenerator buildSequenceGenerator(SequenceGeneratorAnnotation sequenceGeneratorAnnotation) {
- return this.isVirtual() ? null : 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.isVirtual() ? null : 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.tableGenerator != null) {
- result = this.tableGenerator.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- if (this.sequenceGenerator != null) {
- result = this.sequenceGenerator.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
-
- // ********** validation **********
-
- /**
- * The generators are validated in the persistence unit.
- * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateGenerators(List, IReporter)
- */
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- // generators are validated in the persistence unit
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getResourceTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
- protected TextRange getResourceTextRange(CompilationUnit astRoot) {
- return this.owner.getResourceAnnotatedElement().getTextRange(astRoot);
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-
- /**
- * Return whether the container is <em>virtual</em> and, as a result, does
- * not have either a sequence or table generator. As of JPA 2.0, this is
- * only true when the container's parent is a virtual ID mapping.
- */
- // TODO bjv need to add API to JavaGeneratorContainer.Owner
- protected boolean isVirtual() {
- JavaJpaContextNode p = this.getParent();
- if (p instanceof JavaIdMapping) {
- JavaIdMapping idMapping = (JavaIdMapping) p;
- return idMapping.getPersistentAttribute().isVirtual();
- }
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java
deleted file mode 100644
index 7f1aca7b89..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaIdMapping;
-
-
-public class GenericJavaIdMapping
- extends AbstractJavaIdMapping
-{
- public GenericJavaIdMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
deleted file mode 100644
index 2c6dbbeafb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java
+++ /dev/null
@@ -1,211 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Java join column
- */
-public class GenericJavaJoinColumn
- extends AbstractJavaBaseColumn<JoinColumnAnnotation, JavaReadOnlyJoinColumn.Owner>
- implements JavaJoinColumn
-{
- /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation) */
- protected /* final */ JoinColumnAnnotation columnAnnotation; // never null
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericJavaJoinColumn(JavaJpaContextNode parent, JavaReadOnlyJoinColumn.Owner owner) {
- this(parent, owner, null);
- }
-
- public GenericJavaJoinColumn(JavaJpaContextNode parent, JavaReadOnlyJoinColumn.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);
- }
-
-
- // ********** 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
- protected Iterable<String> getConnectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getConnectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.referencedColumnNameTouches(pos, astRoot)) {
- return this.getJavaCandidateReferencedColumnNames(filter);
- }
- 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);
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.getColumnAnnotation().getReferencedColumnNameTextRange(astRoot), astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java
deleted file mode 100644
index 5f26bd42de..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java
+++ /dev/null
@@ -1,465 +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.jpa.core.internal.jpa1.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.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java join table
- * <p>
- * Note: The <code>JoinTable</code> annotation is one of only 2 annotations that
- * can be nested outside of an array (i.e. in an <code>AssociationOverride</code>
- * annotation); the other is {@link GenericJavaColumn Column}.
- */
-public class GenericJavaJoinTable
- extends GenericJavaReferenceTable<JoinTableAnnotation>
- implements JavaJoinTable
-{
- protected final SpecifiedInverseJoinColumnContainer specifiedInverseJoinColumnContainer;
- protected final JavaReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
-
- protected JavaJoinColumn defaultInverseJoinColumn;
-
-
- public GenericJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Owner owner) {
- super(parent, owner);
- this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- this.specifiedInverseJoinColumnContainer = new SpecifiedInverseJoinColumnContainer();
- }
-
- @Override
- protected JavaReadOnlyJoinColumn.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.updateSpecifiedInverseJoinColumns();
- 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 ListIterable<JavaJoinColumn> getInverseJoinColumns() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
- }
-
- public int getInverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumnsSize() : this.defaultInverseJoinColumnsSize();
- }
-
- public void convertDefaultInverseJoinColumnToSpecified() {
- MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this);
- }
-
-
- // ********** specified inverse join columns **********
-
- public ListIterable<JavaJoinColumn> getSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumnsSize() != 0;
- }
-
- public JavaJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumnContainer.getContextElement(index);
- }
-
- public JavaJoinColumn addSpecifiedInverseJoinColumn() {
- return this.addSpecifiedInverseJoinColumn(this.getSpecifiedInverseJoinColumnsSize());
- }
-
- public JavaJoinColumn addSpecifiedInverseJoinColumn(int index) {
- JoinColumnAnnotation annotation = this.getTableAnnotation().addInverseJoinColumn(index);
- return this.specifiedInverseJoinColumnContainer.addContextElement(index, annotation);
- }
-
- public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumnContainer.indexOfContextElement((JavaJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedInverseJoinColumn(int index) {
- this.getTableAnnotation().removeInverseJoinColumn(index);
- this.removeTableAnnotationIfUnset();
- this.specifiedInverseJoinColumnContainer.removeContextElement(index);
- }
-
- public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
- this.getTableAnnotation().moveInverseJoinColumn(targetIndex, sourceIndex);
- this.specifiedInverseJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- public void clearSpecifiedInverseJoinColumns() {
- // for now, we have to remove annotations one at a time...
- for (int i = this.getSpecifiedInverseJoinColumnsSize(); i-- > 0; ) {
- this.removeSpecifiedInverseJoinColumn(i);
- }
- }
-
- protected void syncSpecifiedInverseJoinColumns() {
- this.specifiedInverseJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedInverseJoinColumns() {
- this.specifiedInverseJoinColumnContainer.update();
- }
-
- protected ListIterable<JoinColumnAnnotation> getInverseJoinColumnAnnotations() {
- return this.getTableAnnotation().getInverseJoinColumns();
- }
-
- /**
- * inverse join column container
- */
- protected class SpecifiedInverseJoinColumnContainer
- extends ContextListContainer<JavaJoinColumn, JoinColumnAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_INVERSE_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaJoinColumn buildContextElement(JoinColumnAnnotation resourceElement) {
- return GenericJavaJoinTable.this.buildInverseJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<JoinColumnAnnotation> getResourceElements() {
- return GenericJavaJoinTable.this.getInverseJoinColumnAnnotations();
- }
- @Override
- protected JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
- return contextElement.getColumnAnnotation();
- }
- }
-
- protected JavaReadOnlyJoinColumn.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 : oldTable.getSpecifiedInverseJoinColumns()) {
- this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn);
- }
- }
-
- public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) {
- super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : virtualTable.getInverseJoinColumns()) {
- 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaJoinColumn column : this.getInverseJoinColumns()) {
- result = column.getJavaCompletionProposals(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.validateNodes(this.getInverseJoinColumns(), messages, reporter, astRoot);
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationshipStrategy().validatesAgainstDatabase();
- }
-
-
- // ********** join column owners **********
-
- /**
- * just a little common behavior
- */
- protected abstract class AbstractJoinColumnOwner
- implements JavaReadOnlyJoinColumn.Owner
- {
- protected AbstractJoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getRelationship().getTypeMapping();
- }
-
- /**
- * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
- */
- public String getDefaultColumnName() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * If there is a specified table name it needs to be the same
- * the default table name. The table is always the join table.
- */
- public boolean tableNameIsInvalid(String tableName) {
- return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
- }
-
- /**
- * the join column can only be on the join table itself
- */
- public Iterable<String> getCandidateTableNames() {
- return EmptyIterable.instance();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return Tools.valuesAreEqual(GenericJavaJoinTable.this.getName(), tableName) ?
- GenericJavaJoinTable.this.getDbTable() :
- null;
- }
-
- /**
- * by default, the join column is, obviously, in the join table;
- * not sure whether it can be anywhere else...
- */
- public String getDefaultTableName() {
- return GenericJavaJoinTable.this.getName();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaJoinTable.this.getValidationTextRange(astRoot);
- }
-
- protected JavaRelationship getRelationship() {
- return this.getRelationshipStrategy().getRelationship();
- }
-
- protected JavaJoinTableRelationshipStrategy getRelationshipStrategy() {
- return GenericJavaJoinTable.this.getRelationshipStrategy();
- }
- }
-
-
- /**
- * 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(GenericJavaJoinTable.this.getRelationshipMapping());
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericJavaJoinTable.this.defaultJoinColumn == joinColumn;
- }
-
- public int getJoinColumnsSize() {
- return GenericJavaJoinTable.this.getJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getRelationshipStrategy().buildJoinTableJoinColumnValidator((ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-
-
- /**
- * owner for "forward-pointer" join columns;
- * these point at the target/inverse entity
- */
- protected class InverseJoinColumnOwner
- extends AbstractJoinColumnOwner
- {
- protected InverseJoinColumnOwner() {
- super();
- }
-
- public Entity getRelationshipTarget() {
- RelationshipMapping relationshipMapping = GenericJavaJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- RelationshipMapping relationshipMapping = GenericJavaJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getName();
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- Entity relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericJavaJoinTable.this.defaultInverseJoinColumn == joinColumn;
- }
-
- public int getJoinColumnsSize() {
- return GenericJavaJoinTable.this.getInverseJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getRelationshipStrategy().buildJoinTableInverseJoinColumnValidator((ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java
deleted file mode 100644
index e82aa65ea0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java
+++ /dev/null
@@ -1,50 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.LobConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
-
-public class GenericJavaLobConverter
- extends AbstractJavaConverter
- implements JavaLobConverter
-{
- protected final LobAnnotation lobAnnotation;
-
- public GenericJavaLobConverter(JavaAttributeMapping parent, LobAnnotation lobAnnotation) {
- super(parent);
- this.lobAnnotation = lobAnnotation;
- }
-
-
- // ********** misc **********
-
- public Class<? extends Converter> getType() {
- return LobConverter.class;
- }
-
- @Override
- protected String getAnnotationName() {
- return LobAnnotation.ANNOTATION_NAME;
- }
-
-
- // ********** validation **********
-
- @Override
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- return this.lobAnnotation.getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java
deleted file mode 100644
index 935834c6d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToManyMapping;
-
-public class GenericJavaManyToManyMapping
- extends AbstractJavaManyToManyMapping
-{
- public GenericJavaManyToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java
deleted file mode 100644
index 4cdc288501..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToOneMapping;
-
-public class GenericJavaManyToOneMapping
- extends AbstractJavaManyToOneMapping
-{
- public GenericJavaManyToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java
deleted file mode 100644
index 36d734b5b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaMappedSuperclass;
-import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
-
-/**
- * Java mapped superclass
- */
-public class GenericJavaMappedSuperclass
- extends AbstractJavaMappedSuperclass
-{
- public GenericJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappingAnnotation) {
- super(parent, mappingAnnotation);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
deleted file mode 100644
index d088cf32c9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java
+++ /dev/null
@@ -1,109 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.JoinTable;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.InverseJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableValidator;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-
-public class GenericJavaMappingJoinTableRelationshipStrategy
- extends AbstractJavaJoinTableRelationshipStrategy
- implements JavaMappingJoinTableRelationshipStrategy2_0
-{
- public GenericJavaMappingJoinTableRelationshipStrategy(JavaMappingJoinTableRelationship parent) {
- super(parent);
- }
-
-
- // ********** join table annotation **********
-
- public JoinTableAnnotation getJoinTableAnnotation() {
- return (JoinTableAnnotation) this.getResourceAttribute().getNonNullAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected JoinTableAnnotation addJoinTableAnnotation() {
- return (JoinTableAnnotation) this.getResourceAttribute().addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- }
-
- @Override
- protected void removeJoinTableAnnotation() {
- this.getResourceAttribute().removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- }
-
-
- // ********** misc **********
-
- protected JavaResourceAttribute getResourceAttribute() {
- return this.getRelationship().getMapping().getResourceAttribute();
- }
-
- @Override
- public JavaMappingJoinTableRelationship getParent() {
- return (JavaMappingJoinTableRelationship) super.getParent();
- }
-
- @Override
- public JavaMappingJoinTableRelationship getRelationship() {
- return this.getParent();
- }
-
- public boolean isOverridable() {
- return this.getJpaPlatformVariation().isJoinTableOverridable();
- }
-
- public ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return overrideRelationship.getJoinTableStrategy();
- }
-
-
- // ********** validation **********
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationshipMapping().validatesAgainstDatabase();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationship().getValidationTextRange(astRoot);
- }
-
- protected PersistentAttribute getPersistentAttribute() {
- return this.getRelationshipMapping().getPersistentAttribute();
- }
-
- public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return new JoinTableValidator(this.getPersistentAttribute(), (JoinTable) table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new JoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new InverseJoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
deleted file mode 100644
index 6560856d95..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
+++ /dev/null
@@ -1,96 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <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);
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- // nothing yet
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
deleted file mode 100644
index 81ba83b832..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java
+++ /dev/null
@@ -1,41 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java named query
- */
-public class GenericJavaNamedQuery
- extends AbstractJavaQuery<NamedQueryAnnotation>
- implements JavaNamedQuery
-{
- public GenericJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation queryAnnotation) {
- super(parent, queryAnnotation);
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
- helper.validate(this, this.query, this.getQueryAnnotation().getQueryTextRange(astRoot), 1, messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
deleted file mode 100644
index 46bc58368f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java
+++ /dev/null
@@ -1,44 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-
-/**
- * null mapping used when an attribute's default mapping cannot be determined
- */
-public class GenericJavaNullAttributeMapping
- extends AbstractJavaAttributeMapping<Annotation>
-{
- public GenericJavaNullAttributeMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- public String getKey() {
- return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected String getAnnotationName() {
- return null;
- }
-
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java
deleted file mode 100644
index bf84573cf3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToManyMapping;
-
-public class GenericJavaOneToManyMapping
- extends AbstractJavaOneToManyMapping
-{
- public GenericJavaOneToManyMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java
deleted file mode 100644
index c2f6397a6c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToOneMapping;
-
-public class GenericJavaOneToOneMapping
- extends AbstractJavaOneToOneMapping
-{
- public GenericJavaOneToOneMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
deleted file mode 100644
index 62922210b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java
+++ /dev/null
@@ -1,485 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.OrderColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java ordering
- * <p>
- * <strong>NB:</strong> Setting any flag to <code>false</code> (or setting the
- * specified "order by" to <code>null</code>) can be a bit unpredictable. The
- * intent is to set a flag to <code>true</code> (or set the specified "order by"
- * to a non-<code>null</code> value).
- * <p>
- * <strong>(JPA 2.0 only) NB:</strong> If both the "order by" and the "order
- * column" annotations are present (which is prohibited by the JPA spec),
- * both are ignored.
- */
-public class GenericJavaOrderable
- extends AbstractJavaJpaContextNode
- implements JavaOrderable2_0
-{
- protected String specifiedOrderBy;
- protected boolean noOrdering = false;
- protected boolean pkOrdering = false;
- protected boolean customOrdering = false;
-
- // JPA 2.0
- protected final Owner owner; // this is null for JPA 1.0 mappings
- protected boolean orderColumnOrdering = false;
- protected final JavaOrderColumn2_0 orderColumn;
-
-
- /**
- * JPA 1.0
- */
- public GenericJavaOrderable(JavaAttributeMapping parent) {
- this(parent, null);
- }
-
- /**
- * JPA 2.0
- */
- public GenericJavaOrderable(JavaAttributeMapping parent, Owner owner) {
- super(parent);
- this.specifiedOrderBy = this.buildSpecifiedOrderBy();
- this.noOrdering = this.buildNoOrdering();
- this.pkOrdering = this.buildPkOrdering();
- this.customOrdering = this.buildCustomOrdering();
-
- this.owner = owner;
- this.orderColumnOrdering = this.buildOrderColumnOrdering();
- this.orderColumn = this.buildOrderColumn();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
-
- this.setSpecifiedOrderBy_(this.buildSpecifiedOrderBy());
- this.setNoOrdering_(this.buildNoOrdering());
- this.setPkOrdering_(this.buildPkOrdering());
- this.setCustomOrdering_(this.buildCustomOrdering());
-
- this.setOrderColumnOrdering_(this.buildOrderColumnOrdering());
- this.orderColumn.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.orderColumn.update();
- }
-
-
- // ********** specified order by **********
-
- public String getSpecifiedOrderBy() {
- return this.specifiedOrderBy;
- }
-
- public void setSpecifiedOrderBy(String orderBy) {
- if (orderBy != null) {
- this.removeOrderColumnAnnotation();
- this.getOrderByAnnotationForUpdate().setValue(orderBy);
-
- this.setSpecifiedOrderBy_(orderBy);
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(true);
- this.setOrderColumnOrdering_(false);
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setSpecifiedOrderBy_(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected String buildSpecifiedOrderBy() {
- if (this.orderColumnAnnotationIsPresent()) {
- return null;
- }
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- return (orderByAnnotation == null) ? null : orderByAnnotation.getValue();
- }
-
-
- // ********** no ordering **********
-
- public boolean isNoOrdering() {
- return this.noOrdering;
- }
-
- public void setNoOrdering(boolean noOrdering) {
- if (noOrdering) {
- this.removeOrderColumnAnnotation();
- if (this.getOrderByAnnotation() != null) {
- this.removeOrderByAnnotation();
- }
-
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(true);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(false);
- } else {
- this.setPkOrdering(true); // hmmm...
- }
- }
-
- protected void setNoOrdering_(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
- protected boolean buildNoOrdering() {
- return this.isJpa2_0Compatible() ? this.buildNoOrdering2_0() : this.buildNoOrdering1_0();
- }
-
- /**
- * both annotations are missing <em>or</em> both are present
- */
- protected boolean buildNoOrdering2_0() {
- boolean orderByMissing = (this.getOrderByAnnotation() == null);
- boolean orderByPresent = ! orderByMissing;
- boolean orderColumnMissing = (this.getOrderColumnAnnotation() == null);
- boolean orderColumnPresent = ! orderColumnMissing;
- return (orderByMissing && orderColumnMissing) || (orderByPresent && orderColumnPresent);
- }
-
- /**
- * the order-by annotation is missing
- */
- protected boolean buildNoOrdering1_0() {
- return this.getOrderByAnnotation() == null;
- }
-
-
- // ********** pk ordering **********
-
- public boolean isPkOrdering() {
- return this.pkOrdering;
- }
-
- public void setPkOrdering(boolean pkOrdering) {
- if (pkOrdering) {
- this.removeOrderColumnAnnotation();
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- if (orderByAnnotation == null) {
- this.addOrderByAnnotation();
- } else {
- orderByAnnotation.setValue(null);
- }
-
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(false);
- this.setPkOrdering_(true);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(false);
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setPkOrdering_(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
- /**
- * the order-by annotation is present but no value specified
- */
- protected boolean buildPkOrdering() {
- if (this.orderColumnAnnotationIsPresent()) {
- return false;
- }
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- return (orderByAnnotation != null) && (orderByAnnotation.getValue() == null);
- }
-
-
- // ********** custom ordering **********
-
- public boolean isCustomOrdering() {
- return this.customOrdering;
- }
-
- public void setCustomOrdering(boolean customOrdering) {
- if (customOrdering) {
- this.setSpecifiedOrderBy(""); //$NON-NLS-1$
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setCustomOrdering_(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
-
- /**
- * the order-by annotation is present and it has a specified value
- */
- protected boolean buildCustomOrdering() {
- if (this.orderColumnAnnotationIsPresent()) {
- return false;
- }
- OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation();
- return (orderByAnnotation != null) && (orderByAnnotation.getValue() != null);
- }
-
-
- // ********** order column ordering **********
-
- public boolean isOrderColumnOrdering() {
- return this.orderColumnOrdering;
- }
-
- public void setOrderColumnOrdering(boolean orderColumnOrdering) {
- if (orderColumnOrdering) {
- this.removeOrderByAnnotation();
- if (this.getOrderColumnAnnotation() == null) {
- this.addOrderColumnAnnotation();
- }
-
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(true);
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
- boolean old = this.orderColumnOrdering;
- this.orderColumnOrdering = orderColumnOrdering;
- this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
- }
-
- /**
- * JPA 2.0 only;
- * the order column annotation is present <em>and</em>
- * the order-by annotation is missing
- */
- protected boolean buildOrderColumnOrdering() {
- return this.orderColumnAnnotationIsPresent() &&
- (this.getOrderByAnnotation() == null);
- }
-
-
- // ********** order column **********
-
- public JavaOrderColumn2_0 getOrderColumn() {
- return this.orderColumn;
- }
-
- protected JavaOrderColumn2_0 buildOrderColumn() {
- JavaReadOnlyNamedColumn.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.getResourceAttribute().getAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
- protected OrderByAnnotation getOrderByAnnotationForUpdate() {
- OrderByAnnotation annotation = this.getOrderByAnnotation();
- return (annotation != null) ? annotation : this.addOrderByAnnotation();
- }
-
- protected OrderByAnnotation addOrderByAnnotation() {
- return (OrderByAnnotation) this.getResourceAttribute().addAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeOrderByAnnotation() {
- this.getResourceAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME);
- }
-
-
- // ********** order column annotation **********
-
- protected OrderColumn2_0Annotation getOrderColumnAnnotation() {
- return (OrderColumn2_0Annotation) this.getResourceAttribute().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.getResourceAttribute().addAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME);
- }
-
- protected void removeOrderColumnAnnotation() {
- if (this.orderColumnAnnotationIsPresent()) {
- this.removeOrderColumnAnnotation_();
- }
- }
-
- protected void removeOrderColumnAnnotation_() {
- this.getResourceAttribute().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 JavaResourceAttribute getResourceAttribute() {
- return this.getPersistentAttribute().getResourceAttribute();
- }
-
- // 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- return this.orderColumn.getJavaCompletionProposals(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 JavaReadOnlyNamedColumn.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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new OrderColumnValidator(this.getPersistentAttribute(), (OrderColumn2_0) column, textRangeResolver);
- }
-
- protected JavaPersistentAttribute getPersistentAttribute() {
- return GenericJavaOrderable.this.getPersistentAttribute();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
deleted file mode 100644
index 12382f0f46..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java
+++ /dev/null
@@ -1,320 +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.jpa.core.internal.jpa1.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.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaOverrideJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverride2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class 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() {
- return this.isJpa2_0Compatible() ?
- this.buildStrategy2_0() :
- this.joinColumnStrategy;
- }
-
- /**
- * The overridden mapping determines the override's strategy.
- */
- protected JavaRelationshipStrategy buildStrategy2_0() {
- MappingRelationshipStrategy2_0 mappingStrategy = this.getMappingStrategy();
- return (mappingStrategy != null) ?
- (JavaRelationshipStrategy) mappingStrategy.selectOverrideStrategy(this) :
- this.buildMissingMappingStrategy();
- }
-
- /**
- * Get the strategy from the overridden mapping.
- */
- protected MappingRelationshipStrategy2_0 getMappingStrategy() {
- RelationshipMapping mapping = this.getMapping();
- return (mapping == null) ? null : (MappingRelationshipStrategy2_0) mapping.getRelationship().getStrategy();
- }
-
- /**
- * Return the strategy to use when the override's name does not match the
- * name of an appropriate relationship mapping.
- */
- protected JavaRelationshipStrategy buildMissingMappingStrategy() {
- return this.joinColumnStrategy.hasSpecifiedJoinColumns() ?
- this.joinColumnStrategy :
- this.joinTableStrategy;
- }
-
-
- // ********** join column strategy **********
-
- public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() {
- return this.joinColumnStrategy;
- }
-
- public boolean strategyIsJoinColumn() {
- return this.strategy == this.joinColumnStrategy;
- }
-
- public void setStrategyToJoinColumn() {
- throw new UnsupportedOperationException();
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- // association overrides do not have defaults
- 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() {
- throw new UnsupportedOperationException();
- }
-
- public boolean mayHaveDefaultJoinTable() {
- // association overrides do not have defaults
- return false;
- }
-
- 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();
- }
-
- protected JavaAssociationOverride getAssociationOverride() {
- return this.getParent();
- }
-
- protected JavaAssociationOverride2_0 getAssociationOverride2_0() {
- return (JavaAssociationOverride2_0) this.getAssociationOverride();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getAssociationOverride().getTypeMapping();
- }
-
- public String getAttributeName() {
- return this.getAssociationOverride().getName();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getAssociationOverride().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getAssociationOverride().getCandidateTableNames();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getAssociationOverride().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getAssociationOverride().getDefaultTableName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyBaseColumn column, Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride().buildColumnValidator(column, owner, textRangeResolver);
- }
-
- public AssociationOverrideAnnotation getOverrideAnnotation() {
- return this.getAssociationOverride().getOverrideAnnotation();
- }
-
- 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
-
- return this.strategy.getJavaCompletionProposals(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.strategy.validate(messages, reporter, astRoot);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableValidator(table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
deleted file mode 100644
index a1c781c011..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java
+++ /dev/null
@@ -1,45 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.java.Accessor;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute;
-
-/**
- * Generic Java persistent attribute
- */
-public class GenericJavaPersistentAttribute
- extends AbstractJavaPersistentAttribute
-{
-
- public GenericJavaPersistentAttribute(PersistentType parent, JavaResourceField resourceField) {
- super(parent, resourceField);
- }
-
- public GenericJavaPersistentAttribute(PersistentType parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) {
- super(parent, resourceGetter, resourceSetter);
- }
-
- public GenericJavaPersistentAttribute(PersistentType parent, Accessor accessor) {
- super(parent, accessor);
- }
-
- // ********** validation **********
-
- @Override
- protected JptValidator buildAttributeValidator(CompilationUnit astRoot) {
- return getAccessor().buildAttributeValidator(this, this.buildTextRangeResolver(astRoot));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java
deleted file mode 100644
index ccd859882e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java
+++ /dev/null
@@ -1,46 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
-
-/**
- * JPA 1.0 Java persistent type.
- * The specified access is always null.
- */
-public class GenericJavaPersistentType
- extends AbstractJavaPersistentType
-{
- public GenericJavaPersistentType(PersistentType.Owner parent, JavaResourceType jrt) {
- super(parent, jrt);
- }
-
-
- // ********** 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.
- */
- @Override
- public void setSpecifiedAccess(AccessType specifiedAccess) {
- throw new UnsupportedOperationException("JPA 1.0 does not support a specified access type in java."); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
deleted file mode 100644
index c21453765e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,206 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaPrimaryKeyJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Java primary key join column
- */
-public class GenericJavaPrimaryKeyJoinColumn
- extends AbstractJavaNamedColumn<PrimaryKeyJoinColumnAnnotation, JavaReadOnlyBaseJoinColumn.Owner>
- implements JavaPrimaryKeyJoinColumn
-{
- /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation) */
- protected /* final */ PrimaryKeyJoinColumnAnnotation columnAnnotation; // never null
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaReadOnlyBaseJoinColumn.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
- protected Iterable<String> getConnectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getConnectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.referencedColumnNameTouches(pos, astRoot)) {
- return this.getJavaCandidateReferencedColumnNames(filter);
- }
- 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) {
- return this.getValidationTextRange(this.columnAnnotation.getReferencedColumnNameTextRange(astRoot), astRoot);
- }
-
-
- // ********** misc **********
-
- @Override
- public void toString(StringBuilder sb) {
- super.toString(sb);
- sb.append("=>"); //$NON-NLS-1$
- sb.append(this.getReferencedColumnName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
deleted file mode 100644
index 32fa2370d7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java
+++ /dev/null
@@ -1,265 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-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 ContextListContainer<JavaNamedQuery, NamedQueryAnnotation> namedQueryContainer;
- protected final ContextListContainer<JavaNamedNativeQuery, NamedNativeQueryAnnotation> namedNativeQueryContainer;
-
-
- public GenericJavaQueryContainer(JavaJpaContextNode parent, Owner owner) {
- super(parent);
- this.owner = owner;
- this.namedQueryContainer = this.buildNamedQueryContainer();
- this.namedNativeQueryContainer = this.buildNamedNativeQueryContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncNamedQueries();
- this.syncNamedNativeQueries();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNamedQueries();
- this.updateNamedNativeQueries();
- }
-
-
- // ********** named queries **********
-
-
- public ListIterable<JavaNamedQuery> getNamedQueries() {
- return this.namedQueryContainer.getContextElements();
- }
-
- public int getNamedQueriesSize() {
- return this.namedQueryContainer.getContextElementsSize();
- }
-
- public JavaNamedQuery addNamedQuery() {
- return this.addNamedQuery(this.getNamedQueriesSize());
- }
-
- public JavaNamedQuery addNamedQuery(int index) {
- NamedQueryAnnotation annotation = this.addNamedQueryAnnotation(index);
- return this.namedQueryContainer.addContextElement(index, annotation);
- }
-
- protected NamedQueryAnnotation addNamedQueryAnnotation(int index) {
- return (NamedQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME);
- }
-
- public void removeNamedQuery(NamedQuery namedQuery) {
- this.removeNamedQuery(this.namedQueryContainer.indexOfContextElement((JavaNamedQuery) namedQuery));
- }
-
- public void removeNamedQuery(int index) {
- this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME);
- this.namedQueryContainer.removeContextElement(index);
- }
-
- public void moveNamedQuery(int targetIndex, int sourceIndex) {
- this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedQueryAnnotation.ANNOTATION_NAME);
- this.namedQueryContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected JavaNamedQuery buildNamedQuery(NamedQueryAnnotation namedQueryAnnotation) {
- return this.getJpaFactory().buildJavaNamedQuery(this, namedQueryAnnotation);
- }
-
- protected void syncNamedQueries() {
- this.namedQueryContainer.synchronizeWithResourceModel();
- }
-
- protected void updateNamedQueries() {
- this.namedQueryContainer.update();
- }
-
- protected ListIterable<NamedQueryAnnotation> getNamedQueryAnnotations() {
- return new SubListIterableWrapper<NestableAnnotation, NamedQueryAnnotation>(this.getNestableNamedQueryAnnotations_());
- }
-
- protected ListIterable<NestableAnnotation> getNestableNamedQueryAnnotations_() {
- return this.owner.getResourceAnnotatedElement().getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME);
- }
-
- protected ContextListContainer<JavaNamedQuery, NamedQueryAnnotation> buildNamedQueryContainer() {
- return new NamedQueryContainer();
- }
-
- /**
- * named query container
- */
- protected class NamedQueryContainer
- extends ContextListContainer<JavaNamedQuery, NamedQueryAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return NAMED_QUERIES_LIST;
- }
- @Override
- protected JavaNamedQuery buildContextElement(NamedQueryAnnotation resourceElement) {
- return GenericJavaQueryContainer.this.buildNamedQuery(resourceElement);
- }
- @Override
- protected ListIterable<NamedQueryAnnotation> getResourceElements() {
- return GenericJavaQueryContainer.this.getNamedQueryAnnotations();
- }
- @Override
- protected NamedQueryAnnotation getResourceElement(JavaNamedQuery contextElement) {
- return contextElement.getQueryAnnotation();
- }
- }
-
-
- // ********** named native queries **********
-
- public ListIterable<JavaNamedNativeQuery> getNamedNativeQueries() {
- return this.namedNativeQueryContainer.getContextElements();
- }
-
- public int getNamedNativeQueriesSize() {
- return this.namedNativeQueryContainer.getContextElementsSize();
- }
-
- public JavaNamedNativeQuery addNamedNativeQuery() {
- return this.addNamedNativeQuery(this.getNamedNativeQueriesSize());
- }
-
- public JavaNamedNativeQuery addNamedNativeQuery(int index) {
- NamedNativeQueryAnnotation annotation = this.addNamedNativeQueryAnnotation(index);
- return this.namedNativeQueryContainer.addContextElement(index, annotation);
- }
-
- protected NamedNativeQueryAnnotation addNamedNativeQueryAnnotation(int index) {
- return (NamedNativeQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME);
- }
-
- public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) {
- this.removeNamedNativeQuery(this.namedNativeQueryContainer.indexOfContextElement((JavaNamedNativeQuery) namedNativeQuery));
- }
-
- public void removeNamedNativeQuery(int index) {
- this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME);
- this.namedNativeQueryContainer.removeContextElement(index);
- }
-
- public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
- this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedNativeQueryAnnotation.ANNOTATION_NAME);
- this.namedNativeQueryContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected JavaNamedNativeQuery buildNamedNativeQuery(NamedNativeQueryAnnotation namedNativeQueryAnnotation) {
- return this.getJpaFactory().buildJavaNamedNativeQuery(this, namedNativeQueryAnnotation);
- }
-
- protected void syncNamedNativeQueries() {
- this.namedNativeQueryContainer.synchronizeWithResourceModel();
- }
-
- protected void updateNamedNativeQueries() {
- this.namedNativeQueryContainer.update();
- }
-
- protected ListIterable<NamedNativeQueryAnnotation> getNamedNativeQueryAnnotations() {
- return new SubListIterableWrapper<NestableAnnotation, NamedNativeQueryAnnotation>(this.getNestableNamedNativeQueryAnnotations_());
- }
-
- protected ListIterable<NestableAnnotation> getNestableNamedNativeQueryAnnotations_() {
- return this.owner.getResourceAnnotatedElement().getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME);
- }
-
- protected ContextListContainer<JavaNamedNativeQuery, NamedNativeQueryAnnotation> buildNamedNativeQueryContainer() {
- return new NamedNativeQueryContainer();
- }
-
- /**
- * named query container
- */
- protected class NamedNativeQueryContainer
- extends ContextListContainer<JavaNamedNativeQuery, NamedNativeQueryAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return NAMED_NATIVE_QUERIES_LIST;
- }
- @Override
- protected JavaNamedNativeQuery buildContextElement(NamedNativeQueryAnnotation resourceElement) {
- return GenericJavaQueryContainer.this.buildNamedNativeQuery(resourceElement);
- }
- @Override
- protected ListIterable<NamedNativeQueryAnnotation> getResourceElements() {
- return GenericJavaQueryContainer.this.getNamedNativeQueryAnnotations();
- }
- @Override
- protected NamedNativeQueryAnnotation getResourceElement(JavaNamedNativeQuery contextElement) {
- return contextElement.getQueryAnnotation();
- }
- }
-
-
- // ********** validation **********
-
- /**
- * The queries are validated in the persistence unit.
- * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateQueries(List, IReporter)
- */
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- // queries are validated in the persistence unit
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.owner.getResourceAnnotatedElement().getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaJpaContextNode getParent() {
- return (JavaJpaContextNode) super.getParent();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java
deleted file mode 100644
index 65a5a51027..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java
+++ /dev/null
@@ -1,113 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-
-/**
- * Java query hing
- */
-public class GenericJavaQueryHint
- extends AbstractJavaJpaContextNode
- implements JavaQueryHint
-{
- protected final QueryHintAnnotation queryHintAnnotation;
-
- protected String name;
- protected String value;
-
-
- public GenericJavaQueryHint(JavaQuery parent, QueryHintAnnotation queryHintAnnotation) {
- super(parent);
- this.queryHintAnnotation = queryHintAnnotation;
- this.name = queryHintAnnotation.getName();
- this.value = queryHintAnnotation.getValue();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setName_(this.queryHintAnnotation.getName());
- this.setValue_(this.queryHintAnnotation.getValue());
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.queryHintAnnotation.setName(name);
- this.setName_(name);
- }
-
- protected void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
-
- // ********** value **********
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- this.queryHintAnnotation.setValue(value);
- this.setValue_(value);
- }
-
- protected void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.queryHintAnnotation.getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getQuery().getValidationTextRange(astRoot);
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaQuery getParent() {
- return (JavaQuery) super.getParent();
- }
-
- protected JavaQuery getQuery() {
- return this.getParent();
- }
-
- public QueryHintAnnotation getQueryHintAnnotation() {
- return this.queryHintAnnotation;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
deleted file mode 100644
index c216dd5b76..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java
+++ /dev/null
@@ -1,276 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaReferenceTable;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ReferenceTableAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java join table or collection table
- */
-public abstract class GenericJavaReferenceTable<A extends ReferenceTableAnnotation>
- extends AbstractJavaTable<A>
- implements JavaReferenceTable
-{
- protected final SpecifiedJoinColumnContainer specifiedJoinColumnContainer;
- protected final JavaReadOnlyJoinColumn.Owner joinColumnOwner;
-
- protected JavaJoinColumn defaultJoinColumn;
-
-
- protected GenericJavaReferenceTable(JavaJpaContextNode parent, Owner owner) {
- super(parent, owner);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.specifiedJoinColumnContainer = new SpecifiedJoinColumnContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSpecifiedJoinColumns();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedJoinColumns();
- this.updateDefaultJoinColumn();
- }
-
-
- // ********** join columns **********
-
- public ListIterable<JavaJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int getJoinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
- public void convertDefaultJoinColumnToSpecified() {
- MappingTools.convertReferenceTableDefaultToSpecifiedJoinColumn(this);
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
- return this.specifiedJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- return this.specifiedJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.getSpecifiedJoinColumnsSize() != 0;
- }
-
- public JavaJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumnContainer.getContextElement(index);
- }
-
- public JavaJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.getSpecifiedJoinColumnsSize());
- }
-
- public JavaJoinColumn addSpecifiedJoinColumn(int index) {
- JoinColumnAnnotation annotation = this.getTableAnnotation().addJoinColumn(index);
- return this.specifiedJoinColumnContainer.addContextElement(index, annotation);
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumnContainer.indexOfContextElement((JavaJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- this.getTableAnnotation().removeJoinColumn(index);
- this.removeTableAnnotationIfUnset();
- this.specifiedJoinColumnContainer.removeContextElement(index);
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- this.getTableAnnotation().moveJoinColumn(targetIndex, sourceIndex);
- this.specifiedJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected void syncSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.update();
- }
-
- protected ListIterable<JoinColumnAnnotation> getJoinColumnAnnotations() {
- return this.getTableAnnotation().getJoinColumns();
- }
-
-
- /**
- * join column container
- */
- protected class SpecifiedJoinColumnContainer
- extends ContextListContainer<JavaJoinColumn, JoinColumnAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaJoinColumn buildContextElement(JoinColumnAnnotation resourceElement) {
- return GenericJavaReferenceTable.this.buildJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<JoinColumnAnnotation> getResourceElements() {
- return GenericJavaReferenceTable.this.getJoinColumnAnnotations();
- }
- @Override
- protected JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) {
- return contextElement.getColumnAnnotation();
- }
- }
-
- protected abstract JavaReadOnlyJoinColumn.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 : oldTable.getSpecifiedJoinColumns()) {
- this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
- }
- }
-
- protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) {
- super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : virtualTable.getJoinColumns()) {
- this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn);
- }
- }
-
- protected JavaJoinColumn buildJoinColumn(JoinColumnAnnotation joinColumnAnnotation) {
- return this.buildJoinColumn(this.joinColumnOwner, joinColumnAnnotation);
- }
-
- protected JavaJoinColumn buildJoinColumn(JavaReadOnlyJoinColumn.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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaJoinColumn column : this.getJoinColumns()) {
- result = column.getJavaCompletionProposals(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.validateNodes(this.getJoinColumns(), messages, reporter, astRoot);
- }
-}
-
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
deleted file mode 100644
index c470731b07..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java
+++ /dev/null
@@ -1,363 +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.jpa.core.internal.jpa1.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.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Java secondary table
- */
-public class GenericJavaSecondaryTable
- extends AbstractJavaTable<SecondaryTableAnnotation>
- implements JavaSecondaryTable
-{
- /** @see AbstractJavaTable#AbstractJavaTable(org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation) */
- protected /* final */ SecondaryTableAnnotation tableAnnotation;
-
- protected final JavaPrimaryKeyJoinColumnContainer specifiedPrimaryKeyJoinColumnContainer;
- protected final JavaReadOnlyBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
-
- protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
-
-
- public GenericJavaSecondaryTable(JavaEntity parent, Owner owner, SecondaryTableAnnotation tableAnnotation) {
- super(parent, owner, tableAnnotation);
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.specifiedPrimaryKeyJoinColumnContainer = new JavaPrimaryKeyJoinColumnContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSpecifiedPrimaryKeyJoinColumns();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedPrimaryKeyJoinColumns();
- 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 ListIterable<JavaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
- }
-
- public int getPrimaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
- }
-
-
- // ********** specified primary key join columns **********
-
-
- public ListIterable<JavaPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
- }
-
- protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumnsSize() != 0;
- }
-
- public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.getSpecifiedPrimaryKeyJoinColumnsSize());
- }
-
- public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- PrimaryKeyJoinColumnAnnotation annotation = this.tableAnnotation.addPkJoinColumn(index);
- return this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(index, annotation);
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) {
- this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumnContainer.indexOfContextElement((JavaPrimaryKeyJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- this.tableAnnotation.removePkJoinColumn(index);
- this.removeTableAnnotationIfUnset();
- this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(index);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.tableAnnotation.movePkJoinColumn(targetIndex, sourceIndex);
- this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected void syncSpecifiedPrimaryKeyJoinColumns() {
- this.specifiedPrimaryKeyJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedPrimaryKeyJoinColumns() {
- this.specifiedPrimaryKeyJoinColumnContainer.update();
- }
-
- protected ListIterable<PrimaryKeyJoinColumnAnnotation> getPrimaryKeyJoinColumnAnnotations() {
- return this.tableAnnotation.getPkJoinColumns();
- }
-
- /**
- * specified primary key join column container
- */
- protected class JavaPrimaryKeyJoinColumnContainer
- extends ContextListContainer<JavaPrimaryKeyJoinColumn, PrimaryKeyJoinColumnAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaPrimaryKeyJoinColumn buildContextElement(PrimaryKeyJoinColumnAnnotation resourceElement) {
- return GenericJavaSecondaryTable.this.buildPrimaryKeyJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<PrimaryKeyJoinColumnAnnotation> getResourceElements() {
- return GenericJavaSecondaryTable.this.getPrimaryKeyJoinColumnAnnotations();
- }
- @Override
- protected PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) {
- return contextElement.getColumnAnnotation();
- }
- }
-
- protected JavaReadOnlyBaseJoinColumn.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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaPrimaryKeyJoinColumn column : this.getPrimaryKeyJoinColumns()) {
- result = column.getJavaCompletionProposals(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 (JavaPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) {
- pkJoinColumn.validate(messages, reporter, astRoot);
- }
- }
- }
-
- public boolean validatesAgainstDatabase() {
- return this.connectionProfileIsActive();
- }
-
-
- // ********** primary key join column owner adapter **********
-
- protected class PrimaryKeyJoinColumnOwner
- implements JavaReadOnlyBaseJoinColumn.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 getJoinColumnsSize() {
- return GenericJavaSecondaryTable.this.getPrimaryKeyJoinColumnsSize();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericJavaSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
- }
-
- public String getDefaultColumnName() {
- if (this.getJoinColumnsSize() != 1) {
- return null;
- }
- return this.getEntity().getPrimaryKeyColumnName();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaSecondaryTable.this.getValidationTextRange(astRoot);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericJavaSecondaryTable.this, (ReadOnlyBaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java
deleted file mode 100644
index 88c717be27..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
-
-/**
- * Java sequence generator
- */
-public class GenericJavaSequenceGenerator
- extends AbstractJavaSequenceGenerator<SequenceGeneratorAnnotation>
-{
- public GenericJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation generatorAnnotation) {
- super(parent, generatorAnnotation);
- }
-
-
- // ********** database stuff **********
-
- /**
- * The JPA 1.0 spec does not allow a sequence to specify a catalog.
- */
- @Override
- protected String getCatalog() {
- return this.getContextDefaultCatalog();
- }
-
- /**
- * The JPA 1.0 spec does not allow a sequence to specify a schema.
- */
- @Override
- protected String getSchema() {
- return this.getContextDefaultSchema();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java
deleted file mode 100644
index a0990dd1b9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java
+++ /dev/null
@@ -1,103 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable;
-import org.eclipse.jpt.jpa.core.resource.java.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.getJavaResourceType().getNonNullAnnotation(this.getAnnotationName());
- }
-
- @Override
- protected void removeTableAnnotation() {
- this.getJavaResourceType().removeAnnotation(this.getAnnotationName());
- }
-
- protected String getAnnotationName() {
- return TableAnnotation.ANNOTATION_NAME;
- }
-
- protected JavaResourceType getJavaResourceType() {
- return this.getEntity().getPersistentType().getJavaResourceType();
- }
-
-
- // ********** defaults **********
-
- @Override
- protected String buildDefaultName() {
- return this.getEntity().getDefaultTableName();
- }
-
- /**
- * Just to remember:<ol>
- * <li>{@link org.eclipse.jpt.jpa.core.context.Entity#getDefaultSchema()}<br>
- * check inheritance; get default schema from root
- * <li>{@link org.eclipse.jpt.jpa.core.context.orm.EntityMappings#getSchema()}<br>
- * check for specified schema
- * <li>{@link org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit#getDefaultSchema()}<br>
- * {@link org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults#getSchema()}
- * <li>{@link org.eclipse.jpt.jpa.core.JpaProject#getDefaultSchema()}<br>
- * check for user override project setting
- * <li>{@link org.eclipse.jpt.jpa.db.Catalog#getDefaultSchema()}<br>
- * or {@link org.eclipse.jpt.jpa.db.Database#getDefaultSchema()}
- * </ol>
- */
- @Override
- protected String buildDefaultSchema() {
- return this.getEntity().getDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getEntity().getDefaultCatalog();
- }
-
-
- // ********** validation **********
-
- public boolean validatesAgainstDatabase() {
- return this.connectionProfileIsActive();
- }
-
-
- // ********** misc **********
-
- /**
- * covariant override
- */
- @Override
- public JavaEntity getParent() {
- return (JavaEntity) super.getParent();
- }
-
- protected JavaEntity getEntity() {
- return this.getParent();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
deleted file mode 100644
index c1c3476c2c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java
+++ /dev/null
@@ -1,540 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator;
-import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaGenerator;
-import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-import org.eclipse.jpt.jpa.db.Database;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Java table generator
- */
-public class GenericJavaTableGenerator
- extends AbstractJavaGenerator<TableGeneratorAnnotation>
- implements JavaTableGenerator, UniqueConstraint.Owner
-{
- protected String specifiedTable;
- protected String defaultTable;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedPkColumnName;
- protected String defaultPkColumnName;
-
- protected String specifiedValueColumnName;
- protected String defaultValueColumnName;
-
- protected String specifiedPkColumnValue;
- protected String defaultPkColumnValue;
-
- protected final UniqueConstraintContainer uniqueConstraintContainer;
-
-
- // ********** 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.uniqueConstraintContainer = new UniqueConstraintContainer();
- }
-
-
- // ********** 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 ListIterable<JavaUniqueConstraint> getUniqueConstraints() {
- return this.uniqueConstraintContainer.getContextElements();
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraintContainer.getContextElementsSize();
- }
-
- public JavaUniqueConstraint getUniqueConstraint(int index) {
- return this.uniqueConstraintContainer.getContextElement(index);
- }
-
- public JavaUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.getUniqueConstraintsSize());
- }
-
- public JavaUniqueConstraint addUniqueConstraint(int index) {
- UniqueConstraintAnnotation annotation = this.getGeneratorAnnotation().addUniqueConstraint(index);
- return this.uniqueConstraintContainer.addContextElement(index, annotation);
- }
-
- public void removeUniqueConstraint(int index) {
- this.getGeneratorAnnotation().removeUniqueConstraint(index);
- this.uniqueConstraintContainer.removeContextElement(index);
- }
-
- public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) {
- this.removeUniqueConstraint(this.uniqueConstraintContainer.indexOfContextElement((JavaUniqueConstraint) uniqueConstraint));
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.getGeneratorAnnotation().moveUniqueConstraint(targetIndex, sourceIndex);
- this.uniqueConstraintContainer.moveContextElement(targetIndex, sourceIndex);
- }
-
- protected void syncUniqueConstraints() {
- this.uniqueConstraintContainer.synchronizeWithResourceModel();
- }
-
- protected void updateUniqueConstraints() {
- this.uniqueConstraintContainer.synchronizeWithResourceModel();
- }
-
- protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) {
- return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation);
- }
-
- protected ListIterable<UniqueConstraintAnnotation> getUniqueConstraintAnnotations() {
- return this.getGeneratorAnnotation().getUniqueConstraints();
- }
-
-
- /**
- * unique constraint container
- */
- protected class UniqueConstraintContainer
- extends ContextListContainer<JavaUniqueConstraint, UniqueConstraintAnnotation>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return UNIQUE_CONSTRAINTS_LIST;
- }
- @Override
- protected JavaUniqueConstraint buildContextElement(UniqueConstraintAnnotation resourceElement) {
- return GenericJavaTableGenerator.this.buildUniqueConstraint(resourceElement);
- }
- @Override
- protected ListIterable<UniqueConstraintAnnotation> getResourceElements() {
- return GenericJavaTableGenerator.this.getUniqueConstraintAnnotations();
- }
- @Override
- protected UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) {
- return contextElement.getUniqueConstraintAnnotation();
- }
- }
-
-
- // ********** UniqueConstraint.Owner implementation **********
-
- public Iterable<String> getCandidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.getSortedColumnIdentifiers() : EmptyIterable.<String>instance();
- }
-
-
- // ********** Java completion proposals **********
-
- @Override
- public Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- for (JavaUniqueConstraint constraint : this.getUniqueConstraints()) {
- result = constraint.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * called if the database is connected:
- * table, schema, catalog, pkColumnName, valueColumnName
- */
- @Override
- protected Iterable<String> getConnectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getConnectedJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.tableTouches(pos, astRoot)) {
- return this.getJavaCandidateTables(filter);
- }
- if (this.schemaTouches(pos, astRoot)) {
- return this.getJavaCandidateSchemata(filter);
- }
- if (this.pkColumnNameTouches(pos, astRoot)) {
- return this.getJavaCandidateColumnNames(filter);
- }
- if (this.valueColumnNameTouches(pos, astRoot)) {
- return this.getJavaCandidateColumnNames(filter);
- }
- return null;
- }
-
- // ********** code assist: table
-
- protected boolean tableTouches(int pos, CompilationUnit astRoot) {
- return this.generatorAnnotation.tableTouches(pos, astRoot);
- }
-
- protected Iterable<String> getJavaCandidateTables(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateTables(filter));
- }
-
- protected Iterable<String> getCandidateTables(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateTables(), filter);
- }
-
- protected Iterable<String> getCandidateTables() {
- Schema dbSchema = this.getDbSchema();
- return (dbSchema != null) ? dbSchema.getSortedTableIdentifiers() : EmptyIterable.<String> instance();
- }
-
- // ********** code assist: schema
-
- protected boolean schemaTouches(int pos, CompilationUnit astRoot) {
- return this.generatorAnnotation.schemaTouches(pos, astRoot);
- }
-
- protected Iterable<String> getJavaCandidateSchemata(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateSchemata(filter));
- }
-
- protected Iterable<String> getCandidateSchemata(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateSchemata(), filter);
- }
-
- protected Iterable<String> getCandidateSchemata() {
- SchemaContainer schemaContainer = this.getDbSchemaContainer();
- return (schemaContainer != null) ? schemaContainer.getSortedSchemaIdentifiers() : EmptyIterable.<String> instance();
- }
-
- // ********** code assist: catalog
-
- protected boolean catalogTouches(int pos, CompilationUnit astRoot) {
- return this.generatorAnnotation.catalogTouches(pos, astRoot);
- }
-
- protected Iterable<String> getJavaCandidateCatalogs(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateCatalogs(filter));
- }
-
- protected Iterable<String> getCandidateCatalogs(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateCatalogs(), filter);
- }
-
- protected Iterable<String> getCandidateCatalogs() {
- Database db = this.getDatabase();
- return (db != null) ? db.getSortedCatalogIdentifiers() : EmptyIterable.<String> instance();
- }
-
- // ********** code assist: pkColumnName
-
- protected boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) {
- return this.generatorAnnotation.pkColumnNameTouches(pos, astRoot);
- }
-
- protected Iterable<String> getJavaCandidateColumnNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateColumnNames(filter));
- }
-
- protected Iterable<String> getCandidateColumnNames(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateColumnNames(), filter);
- }
-
- protected Iterable<String> getCandidateColumnNames() {
- Table table = this.getDbTable();
- return (table != null) ? table.getSortedColumnIdentifiers() : EmptyIterable.<String> instance();
- }
-
- // ********** code assist: valueColumnName
-
- protected boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) {
- return this.generatorAnnotation.valueColumnNameTouches(pos, astRoot);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java
deleted file mode 100644
index 65bdbb041b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java
+++ /dev/null
@@ -1,140 +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.jpa.core.internal.jpa1.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.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.TemporalConverter;
-import org.eclipse.jpt.jpa.core.context.TemporalType;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.AbstractJavaElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-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 **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.validateAttributeTypeWithTemporal(messages, astRoot);
- }
-
- protected void validateAttributeTypeWithTemporal(List<IMessage> messages, CompilationUnit astRoot) {
- if (this.getAttributeMapping().getKey() == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
- String typeName = ((AbstractJavaElementCollectionMapping2_0) this.getAttributeMapping()).getFullyQualifiedTargetClass();
- if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
- } else {
- String typeName = this.getAttributeMapping().getPersistentAttribute().getTypeName();
- if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
-
- }
- }
-
- @Override
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- return this.temporalAnnotation.getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java
deleted file mode 100644
index 37e46c1c56..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaTransientMapping;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
-
-/**
- * Java transient mapping
- */
-public class GenericJavaTransientMapping
- extends AbstractJavaAttributeMapping<TransientAnnotation>
- implements JavaTransientMapping
-{
- public GenericJavaTransientMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- @Override
- protected String getAnnotationName() {
- return TransientAnnotation.ANNOTATION_NAME;
- }
-
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
deleted file mode 100644
index 22b291ccca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java
+++ /dev/null
@@ -1,134 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-
-public class GenericJavaUniqueConstraint
- extends AbstractJavaReadOnlyUniqueConstraint
- implements JavaUniqueConstraint
-{
- protected Owner owner;
- protected final UniqueConstraintAnnotation uniqueConstraintAnnotation;
-
-
- public GenericJavaUniqueConstraint(JavaJpaContextNode parent, Owner owner, UniqueConstraintAnnotation uniqueConstraintAnnotation) {
- super(parent);
- this.owner = owner;
- this.uniqueConstraintAnnotation = uniqueConstraintAnnotation;
- this.initializeColumnNames();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncColumnNames();
- }
-
-
- // ********** column names **********
-
- public void addColumnName(String columnName) {
- this.addColumnName(this.columnNames.size(), columnName);
- }
-
- public void addColumnName(int index, String columnName) {
- this.uniqueConstraintAnnotation.addColumnName(index, columnName);
- this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST);
- }
-
- public void removeColumnName(String columnName) {
- this.removeColumnName(this.columnNames.indexOf(columnName));
- }
-
- public void removeColumnName(int index) {
- this.uniqueConstraintAnnotation.removeColumnName(index);
- this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST);
- }
-
- public void moveColumnName(int targetIndex, int sourceIndex) {
- this.uniqueConstraintAnnotation.moveColumnName(targetIndex, sourceIndex);
- this.moveItemInList(targetIndex, sourceIndex, this.columnNames, COLUMN_NAMES_LIST);
- }
-
- protected void initializeColumnNames() {
- for (String columnName : this.getResourceColumnNames()) {
- this.columnNames.add(columnName);
- }
- }
-
- @Override
- protected Iterable<String> getResourceColumnNames() {
- return this.uniqueConstraintAnnotation.getColumnNames();
- }
-
- // ********** Java completion proposals **********
-
- @Override
- protected Iterable<String> getConnectedJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getConnectedJavaCompletionProposals(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 Iterable<String> javaCandidateColumnNames(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() {
- return this.owner.getCandidateUniqueConstraintColumnNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.uniqueConstraintAnnotation.getTextRange(astRoot);
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot);
- }
-
-
- // ********** misc **********
-
- public UniqueConstraintAnnotation getUniqueConstraintAnnotation() {
- return this.uniqueConstraintAnnotation;
- }
-
- public void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint) {
- for (String columnName : oldUniqueConstraint.getColumnNames()) {
- this.addColumnName(columnName);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java
deleted file mode 100644
index 9d66e365f5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVersionMapping;
-
-public class GenericJavaVersionMapping
- extends AbstractJavaVersionMapping
-{
- public GenericJavaVersionMapping(JavaPersistentAttribute parent) {
- super(parent);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java
deleted file mode 100644
index d7f6b3b98d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java
+++ /dev/null
@@ -1,103 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualOverride;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaVirtualAssociationOverride2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Virtual Java association override
- */
-public class GenericJavaVirtualAssociationOverride
- extends AbstractJavaVirtualOverride<JavaAssociationOverrideContainer>
- implements JavaVirtualAssociationOverride2_0
-{
- 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);
- }
-
- protected JavaAssociationOverrideContainer2_0 getContainer2_0() {
- return (JavaAssociationOverrideContainer2_0) this.getContainer();
- }
-
-
- // ********** 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 ReadOnlyRelationship resolveOverriddenRelationship() {
- return this.getContainer().resolveOverriddenRelationship(this.name);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.relationship.validate(messages, reporter, astRoot);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableValidator(this, table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableJoinColumnValidator(this, column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableInverseJoinColumnValidator(this, column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java
deleted file mode 100644
index 90e3122a24..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java
+++ /dev/null
@@ -1,110 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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 **********
-
- @Override
- public String getDefaultTableName() {
- String overriddenColumnTable = this.getOverriddenColumnTable();
- return (overriddenColumnTable != null) ? overriddenColumnTable : super.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 ReadOnlyColumn resolveOverriddenColumn() {
- return this.getContainer().resolveOverriddenColumn(this.name);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, (ReadOnlyBaseColumn) col, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- this.column.validate(messages, reporter, astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java
deleted file mode 100644
index 342eec168b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java
+++ /dev/null
@@ -1,167 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualBaseColumn;
-
-/**
- * Java virtual column
- */
-public class GenericJavaVirtualColumn
- extends AbstractJavaVirtualBaseColumn<JavaVirtualColumn.Owner, ReadOnlyColumn>
- 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 ReadOnlyColumn getOverriddenColumn() {
- return this.owner.resolveOverriddenColumn();
- }
-
-
- // ********** length **********
-
- public int getLength() {
- return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- protected void setSpecifiedLength(Integer length) {
- Integer old = this.specifiedLength;
- this.specifiedLength = length;
- this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
- }
-
- protected Integer buildSpecifiedLength() {
- return this.getOverriddenColumn().getSpecifiedLength();
- }
-
- public int getDefaultLength() {
- return this.defaultLength;
- }
-
- protected void setDefaultLength(int length) {
- int old = this.defaultLength;
- this.defaultLength = length;
- this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length);
- }
-
- protected int buildDefaultLength() {
- return DEFAULT_LENGTH;
- }
-
-
- // ********** precision **********
-
- public int getPrecision() {
- return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision;
- }
-
- public Integer getSpecifiedPrecision() {
- return this.specifiedPrecision;
- }
-
- protected void setSpecifiedPrecision(Integer precision) {
- Integer old = this.specifiedPrecision;
- this.specifiedPrecision = precision;
- this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
- }
-
- protected Integer buildSpecifiedPrecision() {
- return this.getOverriddenColumn().getSpecifiedPrecision();
- }
-
- public int getDefaultPrecision() {
- return this.defaultPrecision;
- }
-
- protected void setDefaultPrecision(int precision) {
- int old = this.defaultPrecision;
- this.defaultPrecision = precision;
- this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision);
- }
-
- protected int buildDefaultPrecision() {
- return DEFAULT_PRECISION;
- }
-
-
- // ********** scale **********
-
- public int getScale() {
- return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale;
- }
-
- public Integer getSpecifiedScale() {
- return this.specifiedScale;
- }
-
- protected void setSpecifiedScale(Integer scale) {
- Integer old = this.specifiedScale;
- this.specifiedScale = scale;
- this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
- }
-
- protected Integer buildSpecifiedScale() {
- return this.getOverriddenColumn().getSpecifiedScale();
- }
-
- public int getDefaultScale() {
- return this.defaultScale;
- }
-
- protected void setDefaultScale(int scale) {
- int old = this.defaultScale;
- this.defaultScale = scale;
- this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale);
- }
-
- protected int buildDefaultScale() {
- return DEFAULT_SCALE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java
deleted file mode 100644
index e80f704d0c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java
+++ /dev/null
@@ -1,140 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Java virtual join column
- */
-public class GenericJavaVirtualJoinColumn
- extends AbstractJavaVirtualBaseColumn<JavaReadOnlyJoinColumn.Owner, ReadOnlyJoinColumn>
- implements JavaVirtualJoinColumn
-{
- protected final ReadOnlyJoinColumn overriddenColumn;
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericJavaVirtualJoinColumn(JavaJpaContextNode parent, JavaReadOnlyJoinColumn.Owner owner, ReadOnlyJoinColumn 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 ReadOnlyJoinColumn 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);
- }
-
-
- // ********** 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 isVirtual() {
- return true;
- }
-
- @Override
- protected String buildDefaultName() {
- return MappingTools.buildJoinColumnDefaultName(this, this.owner);
- }
-
-
- // ********** validation **********
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
- return new JavaJoinColumnTextRangeResolver(this, astRoot);
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
deleted file mode 100644
index aed2b6c106..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,388 +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.jpa.core.internal.jpa1.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.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaVirtualOverrideJoinColumnRelationshipStrategy
- extends AbstractJavaJpaContextNode
- implements JavaVirtualJoinColumnRelationshipStrategy
-{
- protected final SpecifiedJoinColumnContainer specifiedJoinColumnContainer;
- protected final JavaReadOnlyJoinColumn.Owner joinColumnOwner;
-
- protected JavaVirtualJoinColumn defaultJoinColumn;
-
-
- public GenericJavaVirtualOverrideJoinColumnRelationshipStrategy(JavaVirtualOverrideRelationship parent) {
- super(parent);
- this.specifiedJoinColumnContainer = new SpecifiedJoinColumnContainer();
- this.joinColumnOwner = this.buildJoinColumnOwner();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.updateSpecifiedJoinColumns();
- this.updateDefaultJoinColumn();
- }
-
-
- // ********** join columns **********
-
- public ListIterable<JavaVirtualJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int getJoinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<JavaVirtualJoinColumn> getSpecifiedJoinColumns() {
- return this.specifiedJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- return this.specifiedJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.getSpecifiedJoinColumnsSize() != 0;
- }
-
- public JavaVirtualJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumnContainer.getContextElement(index);
- }
-
- protected void updateSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.update();
- }
-
- protected ListIterable<ReadOnlyJoinColumn> getOverriddenSpecifiedJoinColumns() {
- ReadOnlyJoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
- return (overriddenStrategy == null) ?
- EmptyListIterable.<ReadOnlyJoinColumn>instance() :
- new SuperListIterableWrapper<ReadOnlyJoinColumn>(overriddenStrategy.getSpecifiedJoinColumns());
- }
-
-
- protected void moveSpecifiedJoinColumn(int index, JavaVirtualJoinColumn joinColumn) {
- this.specifiedJoinColumnContainer.moveContextElement(index, joinColumn);
- }
-
- protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, ReadOnlyJoinColumn joinColumn) {
- return this.specifiedJoinColumnContainer.addContextElement(index, joinColumn);
- }
-
- protected void removeSpecifiedJoinColumn(JavaVirtualJoinColumn joinColumn) {
- this.specifiedJoinColumnContainer.removeContextElement(joinColumn);
- }
-
- /**
- * specified join column container
- */
- protected class SpecifiedJoinColumnContainer
- extends ContextListContainer<JavaVirtualJoinColumn, ReadOnlyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_JOIN_COLUMNS_LIST;
- }
- @Override
- protected JavaVirtualJoinColumn buildContextElement(ReadOnlyJoinColumn resourceElement) {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.buildJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<ReadOnlyJoinColumn> getResourceElements() {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getOverriddenSpecifiedJoinColumns();
- }
- @Override
- protected ReadOnlyJoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) {
- return contextElement.getOverriddenColumn();
- }
- }
-
- protected JavaReadOnlyJoinColumn.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() {
- ReadOnlyJoinColumn 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 ReadOnlyJoinColumn getOverriddenDefaultJoinColumn() {
- ReadOnlyJoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
- return (overriddenStrategy == null) ? null : overriddenStrategy.getDefaultJoinColumn();
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaVirtualOverrideRelationship getParent() {
- return (JavaVirtualOverrideRelationship) super.getParent();
- }
-
- public JavaVirtualOverrideRelationship getRelationship() {
- return this.getParent();
- }
-
- protected ReadOnlyJoinColumnRelationshipStrategy getOverriddenStrategy() {
- ReadOnlyJoinColumnRelationship relationship = this.getOverriddenJoinColumnRelationship();
- return (relationship == null) ? null : relationship.getJoinColumnStrategy();
- }
-
- protected ReadOnlyJoinColumnRelationship getOverriddenJoinColumnRelationship() {
- ReadOnlyRelationship relationship = this.resolveOverriddenRelationship();
- return (relationship instanceof ReadOnlyJoinColumnRelationship) ? (ReadOnlyJoinColumnRelationship) relationship : null;
- }
-
- protected ReadOnlyRelationship resolveOverriddenRelationship() {
- return this.getRelationship().resolveOverriddenRelationship();
- }
-
- public boolean isTargetForeignKey() {
- RelationshipMapping relationshipMapping = this.getRelationshipMapping();
- return (relationshipMapping != null) &&
- relationshipMapping.getRelationship().isTargetForeignKey();
- }
-
- public TypeMapping getRelationshipSource() {
- return this.isTargetForeignKey() ?
- // relationship mapping is not null
- this.getRelationshipMapping().getResolvedTargetEntity() :
- this.getRelationship().getTypeMapping();
- }
-
- public TypeMapping getRelationshipTarget() {
- return this.isTargetForeignKey() ?
- this.getRelationship().getTypeMapping() :
- // relationship mapping may still be null
- 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.getRelationship().getMapping();
- }
-
- public String getTableName() {
- return this.isTargetForeignKey() ?
- this.getTargetDefaultTableName() :
- this.getRelationship().getDefaultTableName();
- }
-
- protected String getTargetDefaultTableName() {
- TypeMapping typeMapping = this.getRelationshipMapping().getResolvedTargetEntity();
- return (typeMapping == null) ? null : typeMapping.getPrimaryTableName();
- }
-
- protected Table resolveDbTable(String tableName) {
- return this.isTargetForeignKey() ?
- this.resolveTargetDbTable(tableName) :
- this.getRelationship().resolveDbTable(tableName);
- }
-
- protected Table resolveTargetDbTable(String tableName) {
- TypeMapping typeMapping = this.getRelationshipMapping().getResolvedTargetEntity();
- return (typeMapping == null) ? null : typeMapping.resolveDbTable(tableName);
- }
-
- protected boolean tableNameIsInvalid(String tableName) {
- return this.isTargetForeignKey() ?
- this.targetTableNameIsInvalid(tableName) :
- this.getRelationship().tableNameIsInvalid(tableName);
- }
-
- protected boolean targetTableNameIsInvalid(String tableName) {
- TypeMapping typeMapping = this.getRelationshipMapping().getResolvedTargetEntity();
- return (typeMapping != null) && typeMapping.tableNameIsInvalid(tableName);
- }
-
- protected Table getReferencedColumnDbTable() {
- TypeMapping relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
- }
-
- protected Iterable<String> getCandidateTableNames() {
- return this.isTargetForeignKey() ?
- this.getTargetCandidateTableNames() :
- this.getRelationship().getCandidateTableNames();
- }
-
- protected Iterable<String> getTargetCandidateTableNames() {
- TypeMapping typeMapping = this.getRelationshipMapping().getResolvedTargetEntity();
- return (typeMapping != null) ? typeMapping.getAllAssociatedTableNames() : EmptyIterable.<String>instance();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationship().getValidationTextRange(astRoot);
- }
-
- protected String getAttributeName() {
- return this.getRelationship().getAttributeName();
- }
-
- protected JavaVirtualJoinColumn buildJoinColumn(ReadOnlyJoinColumn overriddenJoinColumn) {
- return this.getJpaFactory().buildJavaVirtualJoinColumn(this, this.joinColumnOwner, overriddenJoinColumn);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- super.validate(messages, reporter, astRoot);
- for (JavaVirtualJoinColumn joinColumn : this.getJoinColumns()) {
- joinColumn.validate(messages, reporter, astRoot);
- }
- }
-
-
- // ********** join column owner **********
-
- protected class JoinColumnOwner
- implements JavaReadOnlyJoinColumn.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 tableNameIsInvalid(String tableName) {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getCandidateTableNames();
- }
-
- public Table resolveDbTable(String tableName) {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.resolveDbTable(tableName);
- }
-
- public Table getReferencedColumnDbTable() {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return false;
- }
-
- public int getJoinColumnsSize() {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getJoinColumnsSize();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationship().buildColumnValidator((ReadOnlyBaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
deleted file mode 100644
index 66377b4259..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java
+++ /dev/null
@@ -1,256 +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.jpa.core.internal.jpa1.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverride2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaVirtualOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class 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() {
- return this.isJpa2_0Compatible() ?
- this.buildStrategy2_0() :
- this.joinColumnStrategy;
- }
-
- /**
- * The overridden mapping determines the override's strategy.
- */
- protected JavaVirtualRelationshipStrategy buildStrategy2_0() {
- MappingRelationshipStrategy2_0 mappingStrategy = this.getMappingStrategy();
- return (mappingStrategy != null) ?
- (JavaVirtualRelationshipStrategy) mappingStrategy.selectOverrideStrategy(this) :
- this.buildMissingMappingStrategy();
- }
-
- /**
- * Get the strategy from the overridden mapping.
- */
- protected MappingRelationshipStrategy2_0 getMappingStrategy() {
- RelationshipMapping mapping = this.getMapping();
- return (mapping == null) ? null : (MappingRelationshipStrategy2_0) mapping.getRelationship().getStrategy();
- }
-
- /**
- * Return the strategy to use when the override's name does not match the
- * name of an appropriate relationship mapping.
- */
- protected JavaVirtualRelationshipStrategy buildMissingMappingStrategy() {
- return this.joinColumnStrategy.hasSpecifiedJoinColumns() ?
- this.joinColumnStrategy :
- this.joinTableStrategy;
- }
-
-
- // ********** join column strategy **********
-
- public JavaVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy() {
- return this.joinColumnStrategy;
- }
-
- public boolean strategyIsJoinColumn() {
- return this.strategy == this.joinColumnStrategy;
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- // association overrides do not have defaults
- 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() {
- // association overrides do not have defaults
- return false;
- }
-
- 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();
- }
-
- protected JavaVirtualAssociationOverride getAssociationOverride() {
- return this.getParent();
- }
-
- protected JavaAssociationOverride2_0 getAssociationOverride2_0() {
- return (JavaAssociationOverride2_0) this.getAssociationOverride();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getAssociationOverride().getTypeMapping();
- }
-
- public String getAttributeName() {
- return this.getAssociationOverride().getName();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getAssociationOverride().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getAssociationOverride().getCandidateTableNames();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getAssociationOverride().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getAssociationOverride().getDefaultTableName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyBaseColumn column, Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride().buildColumnValidator(column, owner, textRangeResolver);
- }
-
- 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 ReadOnlyRelationship resolveOverriddenRelationship() {
- return this.getAssociationOverride().resolveOverriddenRelationship();
- }
-
-
- // ********** 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.strategy.validate(messages, reporter, astRoot);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableValidator(table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java
deleted file mode 100644
index 0b5c080248..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java
+++ /dev/null
@@ -1,58 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaReadOnlyUniqueConstraint;
-
-public class GenericJavaVirtualUniqueConstraint
- extends AbstractJavaReadOnlyUniqueConstraint
- implements JavaVirtualUniqueConstraint
-{
- protected final ReadOnlyUniqueConstraint overriddenUniqueConstraint;
-
-
- public GenericJavaVirtualUniqueConstraint(JavaJpaContextNode parent, ReadOnlyUniqueConstraint overriddenUniqueConstraint) {
- super(parent);
- this.overriddenUniqueConstraint = overriddenUniqueConstraint;
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.syncColumnNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getParent().getValidationTextRange(astRoot);
- }
-
-
- // ********** misc **********
-
- public ReadOnlyUniqueConstraint getOverriddenUniqueConstraint() {
- return this.overriddenUniqueConstraint;
- }
-
- @Override
- protected Iterable<String> getResourceColumnNames() {
- return this.overriddenUniqueConstraint.getColumnNames();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java
deleted file mode 100644
index 90d1ba4ff9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java
+++ /dev/null
@@ -1,48 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-
-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 this.getParent().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
deleted file mode 100644
index df7fd609dd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,172 +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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Used by
- * {@link org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaOneToManyRelationship#buildJoinColumnStrategy()}
- * in a JPA 1.0 project.
- */
-public class NullJavaJoinColumnRelationshipStrategy
- extends AbstractJavaJpaContextNode
- implements JavaMappingJoinColumnRelationshipStrategy2_0
-{
- public NullJavaJoinColumnRelationshipStrategy(JavaJoinColumnRelationship parent) {
- super(parent);
- }
-
-
- // ********** join columns **********
-
- public ListIterable<JavaJoinColumn> getJoinColumns() {
- return EmptyListIterable.<JavaJoinColumn>instance();
- }
-
- public int getJoinColumnsSize() {
- return 0;
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<JavaJoinColumn> getSpecifiedJoinColumns() {
- return EmptyListIterable.<JavaJoinColumn>instance();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- 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 ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return null;
- }
-
- 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 this.getRelationship().getValidationTextRange(astRoot);
- }
-
- public String getColumnTableNotValidDescription() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java
deleted file mode 100644
index 547a93fa4c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.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.jpa.core.internal.jpa1.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMappingJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-
-public class NullJavaJoinTableRelationshipStrategy
- extends AbstractJavaJpaContextNode
- implements JavaMappingJoinTableRelationshipStrategy2_0
-{
- public NullJavaJoinTableRelationshipStrategy(JavaJoinTableRelationship parent) {
- super(parent);
- }
-
-
- // ********** join table **********
-
- public JavaJoinTable getJoinTable() {
- return null;
- }
-
- public JoinTableAnnotation getJoinTableAnnotation() {
- return null;
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationship().getValidationTextRange(astRoot);
- }
-
-
- // ********** 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 ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return null;
- }
-
- public void addStrategy() {
- // NOP
- }
-
- public void removeStrategy() {
- // NOP
- }
-
- public boolean isOverridable() {
- return false;
- }
-
- public boolean validatesAgainstDatabase() {
- return false;
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- throw new UnsupportedOperationException();
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java
deleted file mode 100644
index 2968119981..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java
+++ /dev/null
@@ -1,56 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping;
-
-public abstract class AbstractOrmConverter
- extends AbstractOrmXmlContextNode
- implements OrmConverter
-{
- protected AbstractOrmConverter(OrmAttributeMapping parent) {
- super(parent);
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmAttributeMapping getParent() {
- return (OrmAttributeMapping) super.getParent();
- }
-
- protected OrmAttributeMapping getAttributeMapping() {
- return this.getParent();
- }
-
- protected XmlAttributeMapping getXmlAttributeMapping() {
- return this.getAttributeMapping().getXmlAttributeMapping();
- }
-
- protected XmlConvertibleMapping getXmlConvertibleMapping() {
- return (XmlConvertibleMapping) this.getXmlAttributeMapping();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlValidationTextRange();
- return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange();
- }
-
- protected abstract TextRange getXmlValidationTextRange();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java
deleted file mode 100644
index fb81f2581e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java
+++ /dev/null
@@ -1,173 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Specified <code>orm.xml</code> 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();
- }
-
- protected 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());
- }
-
- public TypeMapping getTypeMapping() {
- return this.getContainer().getTypeMapping();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getContainer().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getContainer().getDefaultTableName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyBaseColumn column, Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, column, owner, textRangeResolver);
- }
-
- @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().buildOverrideValidator(this, this.buildTextRangeResolver());
- }
-
- protected OverrideTextRangeResolver buildTextRangeResolver() {
- return new OrmOverrideTextRangeResolver(this);
- }
-
- /**
- * @see AbstractOrmOverrideContainer#getValidationTextRange()
- */
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlOverride.getValidationTextRange();
- // skip the container since it really doesn't have a text range
- // (also, this prevents a stack overflow)
- return (textRange != null) ? textRange : this.getContainer().getParent().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange(this.xmlOverride.getNameTextRange());
- }
-
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getContainer().tableNameIsInvalid(tableName);
- }
-
-
- public Iterable<String> getCandidateTableNames() {
- return this.getContainer().getCandidateTableNames();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
deleted file mode 100644
index 35d55a481f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java
+++ /dev/null
@@ -1,474 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import java.util.Vector;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.Override_;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.VirtualOverride;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> override container
- */
-public abstract class AbstractOrmOverrideContainer<
- O extends OrmOverrideContainer.Owner,
- R extends OrmReadOnlyOverride,
- S extends OrmOverride,
- V extends OrmVirtualOverride,
- X extends XmlOverride
- >
- extends AbstractOrmXmlContextNode
- implements OrmOverrideContainer
-{
- // this can be null if the container is "read-only" (i.e. a "null" container)
- protected final O owner;
-
- protected final Vector<S> specifiedOverrides = new Vector<S>();
- protected final SpecifiedOverrideContainerAdapter specifiedOverrideContainerAdapter = new SpecifiedOverrideContainerAdapter();
-
- protected final Vector<V> virtualOverrides = new Vector<V>();
- protected final VirtualOverrideContainerAdapter virtualOverrideContainerAdapter = new VirtualOverrideContainerAdapter();
-
-
- protected AbstractOrmOverrideContainer(XmlContextNode parent, O owner) {
- super(parent);
- this.owner = owner;
- this.initializeSpecifiedOverrides();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSpecifiedOverrides();
- // the virtual overrides do not need a sync
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(this.getSpecifiedOverrides());
- this.updateVirtualOverrides();
- }
-
-
- // ********** overrides **********
-
- @SuppressWarnings("unchecked")
- public ListIterable<R> getOverrides() {
- return new CompositeListIterable<R>(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides());
- }
-
- public int getOverridesSize() {
- 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.getPossibleVirtualOverrideNames(), 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 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 getSpecifiedOverridesSize() {
- 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 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 getVirtualOverridesSize() {
- 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 new FilteringIterable<String>(this.getPossibleVirtualOverrideNames()) {
- @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 **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return this.owner.getOverridableTypeMapping();
- }
-
- public TypeMapping getTypeMapping() {
- return this.owner.getTypeMapping();
- }
-
- /**
- * Return all the possible virtual override names. If we have a
- * corresponding Java entity, take the override names from it. This allows
- * us to include any Java specified overrides that are invalid (and
- * generate the appropriate error messages). If we don't have a
- * corresponding Java entity, take the override names directly from the
- * type.
- */
- protected Iterable<String> getPossibleVirtualOverrideNames() {
- if (this.owner == null) {
- return EmptyIterable.instance();
- }
- Iterable<String> javaNames = this.owner.getJavaOverrideNames();
- return (javaNames != null) ? javaNames : this.owner.getAllOverridableNames();
- }
-
- public Iterable<String> getAllOverridableNames() {
- return (this.owner != null) ? this.owner.getAllOverridableNames() : EmptyIterable.<String>instance();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.owner.tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.owner.getCandidateTableNames();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return this.owner.resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.owner.getDefaultTableName();
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideTextRangeResolver textRangeResolver) {
- return this.owner.buildOverrideValidator(override, this, textRangeResolver);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.owner.buildColumnValidator(override, column, columnOwner, textRangeResolver);
- }
-
- protected R selectOverrideNamed(Iterable<R> overrides, String name) {
- return this.selectOverrideNamed(overrides, name, null);
- }
-
- protected R selectOverrideNamed(Iterable<R> overrides, String name, S exclude) {
- for (R override : overrides) {
- if (override == exclude) {
- continue; // skip
- }
- if (this.valuesAreEqual(override.getName(), name)) {
- return override;
- }
- }
- return null;
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- for (R override : this.getOverrides()) {
- override.validate(messages, reporter);
- }
- }
-
- public TextRange getValidationTextRange() {
- return (this.specifiedOverrides.size() > 0) ?
- this.specifiedOverrides.get(0).getValidationTextRange() :
- this.owner.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmPersistenceUnitDefaults.java
deleted file mode 100644
index 580eaa33b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmPersistenceUnitDefaults.java
+++ /dev/null
@@ -1,348 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistenceUnitDefaults2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.db.Catalog;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.SchemaContainer;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>persistence-unit-defaults</code> element
- */
-public abstract class AbstractOrmPersistenceUnitDefaults
- 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 **********
-
- protected AbstractOrmPersistenceUnitDefaults(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 = this.buildXmlPersistenceUnitDefaults();
- xmlMetadata.setPersistenceUnitDefaults(xmlDefaults);
- return xmlDefaults;
- }
-
- protected abstract XmlPersistenceUnitDefaults buildXmlPersistenceUnitDefaults();
-
- /**
- * 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() {
- TextRange textRange = this.getXmlTextRange();
- return (textRange != null) ? textRange : this.getPersistenceUnitMetadata().getValidationTextRange();
- }
-
- protected TextRange getXmlTextRange() {
- XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults();
- return (xmlDefaults == null) ? null : xmlDefaults.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmPersistenceUnitMetadata.java
deleted file mode 100644
index f0d6f9963c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmPersistenceUnitMetadata.java
+++ /dev/null
@@ -1,190 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistenceUnitMetadata2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>persistence-unit-metadata</code> element
- */
-public abstract class AbstractOrmPersistenceUnitMetadata
- extends AbstractOrmXmlContextNode
- implements OrmPersistenceUnitMetadata2_0
-{
- protected boolean xmlMappingMetadataComplete;
-
- protected String description;
-
- // never null
- protected final OrmPersistenceUnitDefaults persistenceUnitDefaults;
-
-
- protected AbstractOrmPersistenceUnitMetadata(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 abstract XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata_();
-
- 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();
- }
-
- protected EntityMappings getEntityMappings() {
- return this.getParent();
- }
-
- public XmlEntityMappings getXmlEntityMappings() {
- return this.getEntityMappings().getXmlEntityMappings();
- }
-
- public boolean resourceExists() {
- return this.getXmlPersistenceUnitMetadata() != null;
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlTextRange();
- return (textRange != null) ? textRange : this.getEntityMappings().getValidationTextRange();
- }
-
- protected TextRange getXmlTextRange() {
- XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata();
- return (xmlMetadata == null) ? null : xmlMetadata.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java
deleted file mode 100644
index ec9acf34bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java
+++ /dev/null
@@ -1,119 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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();
- }
-
- protected C getContainer() {
- return this.getParent();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getContainer().getTypeMapping();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getContainer().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getContainer().getDefaultTableName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyBaseColumn column, Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, column, owner, textRangeResolver);
- }
-
- @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().buildOverrideValidator(this, this.buildTextRangeResolver());
- }
-
- protected OverrideTextRangeResolver buildTextRangeResolver() {
- return new OrmOverrideTextRangeResolver(this);
- }
-
- public TextRange getValidationTextRange() {
- return this.getContainer().getValidationTextRange();
- }
-
- public TextRange getNameTextRange() {
- return this.getValidationTextRange();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getContainer().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getContainer().getCandidateTableNames();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java
deleted file mode 100644
index a6ae9ee62b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>entity-mappings</code> element
- */
-public class GenericEntityMappings
- extends AbstractEntityMappings
-{
- public GenericEntityMappings(OrmXml parent, XmlEntityMappings resource) {
- super(parent, resource);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
deleted file mode 100644
index 2ff662f8ff..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java
+++ /dev/null
@@ -1,119 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverride2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Specified <code>orm.xml</code> association override
- */
-public class GenericOrmAssociationOverride
- extends AbstractOrmOverride<OrmAssociationOverrideContainer, XmlAssociationOverride>
- implements OrmAssociationOverride2_0
-{
- 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 **********
-
- protected OrmAssociationOverrideContainer2_0 getContainer2_0() {
- return (OrmAssociationOverrideContainer2_0) this.getContainer();
- }
-
- 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);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableValidator(this, table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableJoinColumnValidator(this, column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableInverseJoinColumnValidator(this, column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
deleted file mode 100644
index f0d01182d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java
+++ /dev/null
@@ -1,98 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-
-/**
- * <code>orm.xml</code> association override container
- */
-public class GenericOrmAssociationOverrideContainer
- extends AbstractOrmOverrideContainer<
- OrmAssociationOverrideContainer.Owner,
- OrmReadOnlyAssociationOverride,
- OrmAssociationOverride,
- OrmVirtualAssociationOverride,
- XmlAssociationOverride
- >
- implements OrmAssociationOverrideContainer2_0
-{
- public GenericOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner) {
- super(parent, owner);
- }
-
-
- public RelationshipMapping getRelationshipMapping(String attributeName) {
- return MappingTools.getRelationshipMapping(attributeName, this.owner.getOverridableTypeMapping());
- }
-
- public ReadOnlyRelationship resolveOverriddenRelationship(String associationOverrideName) {
- return this.owner.resolveOverriddenRelationship(associationOverrideName);
- }
-
- protected OrmAssociationOverrideContainer2_0.Owner getOwner2_0() {
- return (OrmAssociationOverrideContainer2_0.Owner) this.owner;
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner columnOwner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getOwner2_0().buildJoinTableJoinColumnValidator(override, column, columnOwner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner columnOwner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getOwner2_0().buildJoinTableInverseJoinColumnValidator(override, column, columnOwner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return this.getOwner2_0().buildJoinTableValidator(override, table, textRangeResolver);
- }
-
- @Override
- protected Iterable<XmlAssociationOverride> getXmlOverrides_() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneIterable<XmlAssociationOverride>(this.owner.getXmlOverrides());
- }
-
- @Override
- protected XmlAssociationOverride buildXmlOverride() {
- return OrmFactory.eINSTANCE.createXmlAssociationOverride();
- }
-
- @Override
- protected OrmAssociationOverride buildSpecifiedOverride(XmlAssociationOverride xmlOverride) {
- return this.getContextNodeFactory().buildOrmAssociationOverride(this, xmlOverride);
- }
-
- @Override
- protected void initializeSpecifiedOverride(OrmAssociationOverride specifiedOverride, OrmVirtualAssociationOverride virtualOverride) {
- specifiedOverride.initializeFromVirtual(virtualOverride);
- }
-
- @Override
- protected OrmVirtualAssociationOverride buildVirtualOverride(String name) {
- return this.getContextNodeFactory().buildOrmVirtualAssociationOverride(this, name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
deleted file mode 100644
index d55b328692..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java
+++ /dev/null
@@ -1,155 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-import org.eclipse.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 String getDefaultColumnName() {
- return this.name;
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, (ReadOnlyBaseColumn) col, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
-
- 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 attributeIsDerivedId() {
- return this.getTypeMapping().attributeIsDerivedId(this.name);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- if (this.attributeIsDerivedId()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ATTRIBUTE_OVERRIDE_DERIVED_AND_SPECIFIED,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange()
- )
- );
-
- // validate the column if it is specified
- if (this.xmlColumnIsSpecified()) {
- this.column.validate(messages, reporter);
- }
- } else {
- this.column.validate(messages, reporter);
- }
- }
-
- protected boolean xmlColumnIsSpecified() {
- return this.getXmlColumn() != null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
deleted file mode 100644
index 6b56484f04..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java
+++ /dev/null
@@ -1,75 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-
-/**
- * <code>orm.xml</code> attribute override container
- */
-public class GenericOrmAttributeOverrideContainer
- extends AbstractOrmOverrideContainer<
- OrmAttributeOverrideContainer.Owner,
- OrmReadOnlyAttributeOverride,
- OrmAttributeOverride,
- OrmVirtualAttributeOverride,
- XmlAttributeOverride
- >
- implements OrmAttributeOverrideContainer
-{
- public GenericOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner) {
- super(parent, owner);
- }
-
-
- public ReadOnlyColumn 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 : oldContainer.getSpecifiedOverrides()) {
- this.addSpecifiedOverride().initializeFrom(oldOverride);
- }
- }
-
- @Override
- protected void initializeSpecifiedOverride(OrmAttributeOverride specifiedOverride, OrmVirtualAttributeOverride virtualOverride) {
- specifiedOverride.initializeFromVirtual(virtualOverride);
- }
-
- @Override
- protected OrmVirtualAttributeOverride buildVirtualOverride(String name) {
- return this.getContextNodeFactory().buildOrmVirtualAttributeOverride(this, name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java
deleted file mode 100644
index 99f763d272..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBasicMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic;
-
-/**
- * <code>orm.xml</code> basic mapping
- */
-public class GenericOrmBasicMapping
- extends AbstractOrmBasicMapping<XmlBasic>
-{
- public GenericOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java
deleted file mode 100644
index 76cba3a5c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java
+++ /dev/null
@@ -1,306 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Cascade;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.Cascade2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCascade2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.CascadeType;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-
-public class GenericOrmCascade
- extends AbstractOrmXmlContextNode
- implements OrmCascade2_0
-{
- protected boolean all;
-
- protected boolean persist;
-
- protected boolean merge;
-
- protected boolean remove;
-
- protected boolean refresh;
-
- /* JPA 2.0 */
- protected boolean detach;
-
-
- /**
- * This is built directly by the mapping implementation; as opposed to via
- * a platform-specific factory.
- * @see AbstractOrmRelationshipMapping#buildCascade()
- */
- public GenericOrmCascade(OrmRelationshipMapping parent) {
- super(parent);
- this.all = this.buildAll();
- this.persist = this.buildPersist();
- this.merge = this.buildMerge();
- this.remove = this.buildRemove();
- this.refresh = this.buildRefresh();
- this.detach = this.buildDetach();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setAll_(this.buildAll());
- this.setPersist_(this.buildPersist());
- this.setMerge_(this.buildMerge());
- this.setRemove_(this.buildRemove());
- this.setRefresh_(this.buildRefresh());
- this.setDetach_(this.buildDetach());
- }
-
-
- // ********** all **********
-
- public boolean isAll() {
- return this.all;
- }
-
- public void setAll(boolean all) {
- if (this.all != all) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setAll_(all);
- xmlCascade.setCascadeAll(all);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected void setAll_(boolean all) {
- boolean old = this.all;
- this.all = all;
- this.firePropertyChanged(ALL_PROPERTY, old, all);
- }
-
- protected boolean buildAll() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeAll();
- }
-
-
- // ********** persist **********
-
- public boolean isPersist() {
- return this.persist;
- }
-
- public void setPersist(boolean persist) {
- if (this.persist != persist) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setPersist_(persist);
- xmlCascade.setCascadePersist(persist);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setPersist_(boolean persist) {
- boolean old = this.persist;
- this.persist = persist;
- return this.firePropertyChanged(PERSIST_PROPERTY, old, persist);
- }
-
- protected boolean buildPersist() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadePersist();
- }
-
-
- // ********** merge **********
-
- public boolean isMerge() {
- return this.merge;
- }
-
- public void setMerge(boolean merge) {
- if (this.merge != merge) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setMerge_(merge);
- xmlCascade.setCascadeMerge(merge);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setMerge_(boolean merge) {
- boolean old = this.merge;
- this.merge = merge;
- return this.firePropertyChanged(MERGE_PROPERTY, old, merge);
- }
-
- protected boolean buildMerge() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeMerge();
- }
-
-
- // ********** remove **********
-
- public boolean isRemove() {
- return this.remove;
- }
-
- public void setRemove(boolean remove) {
- if (this.remove != remove) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setRemove_(remove);
- xmlCascade.setCascadeRemove(remove);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setRemove_(boolean remove) {
- boolean old = this.remove;
- this.remove = remove;
- return this.firePropertyChanged(REMOVE_PROPERTY, old, remove);
- }
-
- protected boolean buildRemove() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeRemove();
- }
-
-
- // ********** refresh **********
-
- public boolean isRefresh() {
- return this.refresh;
- }
-
- public void setRefresh(boolean refresh) {
- if (this.refresh != refresh) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setRefresh_(refresh);
- xmlCascade.setCascadeRefresh(refresh);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setRefresh_(boolean refresh) {
- boolean old = this.refresh;
- this.refresh = refresh;
- return this.firePropertyChanged(REFRESH_PROPERTY, old, refresh);
- }
-
- protected boolean buildRefresh() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeRefresh();
- }
-
-
- // ********** detach **********
-
- public boolean isDetach() {
- return this.detach;
- }
-
- public void setDetach(boolean detach) {
- if (this.detach != detach) {
- CascadeType xmlCascade = this.getXmlCascadeForUpdate();
- this.setDetach_(detach);
- xmlCascade.setCascadeDetach(detach);
- this.removeXmlCascadeIfUnset();
- }
- }
-
- protected boolean setDetach_(boolean detach) {
- boolean old = this.detach;
- this.detach = detach;
- return this.firePropertyChanged(DETACH_PROPERTY, old, detach);
- }
-
- protected boolean buildDetach() {
- return this.isJpa2_0Compatible() && this.buildDetach_();
- }
-
- protected boolean buildDetach_() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) && xmlCascade.isCascadeDetach();
- }
-
-
- // ********** XML cascade **********
-
- /**
- * Return <code>null</code> if XML cascade does not exists.
- */
- protected CascadeType getXmlCascade() {
- return this.getXmlRelationshipMapping().getCascade();
- }
-
- /**
- * Build the XML cascade if it does not exist.
- */
- protected CascadeType getXmlCascadeForUpdate() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade != null) ? xmlCascade : this.buildXmlCascade();
- }
-
- protected CascadeType buildXmlCascade() {
- CascadeType xmlCascade = OrmFactory.eINSTANCE.createCascadeType();
- this.getXmlRelationshipMapping().setCascade(xmlCascade);
- return xmlCascade;
- }
-
- protected void removeXmlCascadeIfUnset() {
- if (this.getXmlCascade().isUnset()) {
- this.removeXmlCascade();
- }
- }
-
- protected void removeXmlCascade() {
- this.getXmlRelationshipMapping().setCascade(null);
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmRelationshipMapping getParent() {
- return (OrmRelationshipMapping) super.getParent();
- }
-
- protected OrmRelationshipMapping getRelationshipMapping() {
- return this.getParent();
- }
-
- protected AbstractXmlRelationshipMapping getXmlRelationshipMapping() {
- return this.getRelationshipMapping().getXmlAttributeMapping();
- }
-
- public void initializeFrom(Cascade oldCascade) {
- this.setAll(oldCascade.isAll());
- this.setPersist(oldCascade.isPersist());
- this.setMerge(oldCascade.isMerge());
- this.setRemove(oldCascade.isRemove());
- this.setRefresh(oldCascade.isRefresh());
- if (this.isJpa2_0Compatible()) {
- this.setDetach(((Cascade2_0) oldCascade).isDetach());
- }
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlTextRange();
- return (textRange != null) ? textRange : this.getRelationshipMapping().getValidationTextRange();
- }
-
- protected TextRange getXmlTextRange() {
- CascadeType xmlCascade = this.getXmlCascade();
- return (xmlCascade == null) ? null : xmlCascade.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java
deleted file mode 100644
index 6e254476eb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-
-/**
- * <code>orm.xml</code> column
- */
-public class GenericOrmColumn
- extends AbstractOrmBaseColumn<XmlColumn, OrmColumn.Owner>
- implements OrmColumn
-{
- // TODO defaults from java for all of these settings
- protected Integer specifiedLength;
-
- protected Integer specifiedPrecision;
-
- protected Integer specifiedScale;
-
-
- public GenericOrmColumn(XmlContextNode parent, OrmColumn.Owner owner) {
- super(parent, owner);
- this.specifiedLength = this.buildSpecifiedLength();
- this.specifiedPrecision = this.buildSpecifiedPrecision();
- this.specifiedScale = this.buildSpecifiedScale();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedLength_(this.buildSpecifiedLength());
- this.setSpecifiedPrecision_(this.buildSpecifiedPrecision());
- this.setSpecifiedScale_(this.buildSpecifiedScale());
- }
-
-
- // ********** XML column **********
-
- @Override
- public XmlColumn getXmlColumn() {
- return this.owner.getXmlColumn();
- }
-
- @Override
- protected XmlColumn buildXmlColumn() {
- return this.owner.buildXmlColumn();
- }
-
- @Override
- protected void removeXmlColumn() {
- this.owner.removeXmlColumn();
- }
-
-
- // ********** length **********
-
- public int getLength() {
- return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.getDefaultLength();
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer length) {
- if (this.valuesAreDifferent(this.specifiedLength, length)) {
- XmlColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedLength_(length);
- xmlColumn.setLength(length);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedLength_(Integer length) {
- Integer old = this.specifiedLength;
- this.specifiedLength = length;
- this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
- }
-
- protected Integer buildSpecifiedLength() {
- XmlColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getLength();
- }
-
- public int getDefaultLength() {
- return DEFAULT_LENGTH;
- }
-
-
- // ********** precision **********
-
- public int getPrecision() {
- return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.getDefaultPrecision();
- }
-
- public Integer getSpecifiedPrecision() {
- return this.specifiedPrecision;
- }
-
- public void setSpecifiedPrecision(Integer precision) {
- if (this.valuesAreDifferent(this.specifiedPrecision, precision)) {
- XmlColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedPrecision_(precision);
- xmlColumn.setPrecision(precision);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedPrecision_(Integer precision) {
- Integer old = this.specifiedPrecision;
- this.specifiedPrecision = precision;
- this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
- }
-
- protected Integer buildSpecifiedPrecision() {
- XmlColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getPrecision();
- }
-
- public int getDefaultPrecision() {
- return DEFAULT_PRECISION;
- }
-
-
- // ********** scale **********
-
- public int getScale() {
- return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.getDefaultScale();
- }
-
- public Integer getSpecifiedScale() {
- return this.specifiedScale;
- }
-
- public void setSpecifiedScale(Integer scale) {
- if (this.valuesAreDifferent(this.specifiedScale, scale)) {
- XmlColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedScale_(scale);
- xmlColumn.setScale(scale);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedScale_(Integer scale) {
- Integer old = this.specifiedScale;
- this.specifiedScale = scale;
- this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
- }
-
- protected Integer buildSpecifiedScale() {
- XmlColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getScale();
- }
-
- public int getDefaultScale() {
- return DEFAULT_SCALE;
- }
-
-
- // ********** misc **********
-
- public void initializeFrom(ReadOnlyColumn oldColumn) {
- super.initializeFrom(oldColumn);
- this.setSpecifiedLength(oldColumn.getSpecifiedLength());
- this.setSpecifiedPrecision(oldColumn.getSpecifiedPrecision());
- this.setSpecifiedScale(oldColumn.getSpecifiedScale());
- }
-
- public void initializeFromVirtual(ReadOnlyColumn virtualColumn) {
- super.initializeFromVirtual(virtualColumn);
- // ignore other settings?
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java
deleted file mode 100644
index be90386975..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.DiscriminatorType;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn;
-
-/**
- * <code>orm.xml</code> discriminator column
- */
-public class GenericOrmDiscriminatorColumn
- extends AbstractOrmNamedColumn<XmlDiscriminatorColumn, OrmDiscriminatorColumn.Owner>
- implements OrmDiscriminatorColumn
-{
- protected DiscriminatorType specifiedDiscriminatorType;
- protected DiscriminatorType defaultDiscriminatorType;
-
- protected Integer specifiedLength;
- protected int defaultLength;
-
-
- public GenericOrmDiscriminatorColumn(XmlContextNode parent, OrmDiscriminatorColumn.Owner owner) {
- super(parent, owner);
- this.specifiedDiscriminatorType = this.buildSpecifiedDiscriminatorType();
- this.specifiedLength = this.buildSpecifiedLength();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedDiscriminatorType_(this.buildSpecifiedDiscriminatorType());
- this.setSpecifiedLength_(this.buildSpecifiedLength());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultDiscriminatorType(this.buildDefaultDiscriminatorType());
- this.setDefaultLength(this.buildDefaultLength());
- }
-
-
- // ********** XML column **********
-
- @Override
- public XmlDiscriminatorColumn getXmlColumn() {
- return this.owner.getXmlColumn();
- }
-
- @Override
- protected XmlDiscriminatorColumn buildXmlColumn() {
- return this.owner.buildXmlColumn();
- }
-
- @Override
- protected void removeXmlColumn() {
- this.owner.removeXmlColumn();
- }
-
-
- // ********** discriminator type **********
-
- public DiscriminatorType getDiscriminatorType() {
- return (this.specifiedDiscriminatorType != null) ? this.specifiedDiscriminatorType : this.defaultDiscriminatorType;
- }
-
- public DiscriminatorType getSpecifiedDiscriminatorType() {
- return this.specifiedDiscriminatorType;
- }
-
- public void setSpecifiedDiscriminatorType(DiscriminatorType discriminatorType) {
- if (this.valuesAreDifferent(this.specifiedDiscriminatorType, discriminatorType)) {
- XmlDiscriminatorColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedDiscriminatorType_(discriminatorType);
- xmlColumn.setDiscriminatorType(DiscriminatorType.toOrmResourceModel(discriminatorType));
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedDiscriminatorType_(DiscriminatorType discriminatorType) {
- DiscriminatorType old = this.specifiedDiscriminatorType;
- this.specifiedDiscriminatorType = discriminatorType;
- this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
- }
-
- protected DiscriminatorType buildSpecifiedDiscriminatorType() {
- XmlDiscriminatorColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : DiscriminatorType.fromOrmResourceModel(xmlColumn.getDiscriminatorType());
- }
-
- public DiscriminatorType getDefaultDiscriminatorType() {
- return this.defaultDiscriminatorType;
- }
-
- protected void setDefaultDiscriminatorType(DiscriminatorType discriminatorType) {
- DiscriminatorType old = this.defaultDiscriminatorType;
- this.defaultDiscriminatorType = discriminatorType;
- this.firePropertyChanged(DEFAULT_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType);
- }
-
- protected DiscriminatorType buildDefaultDiscriminatorType() {
- return this.owner.getDefaultDiscriminatorType();
- }
-
-
- // ********** length **********
-
- public int getLength() {
- return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- public void setSpecifiedLength(Integer length) {
- if (this.valuesAreDifferent(this.specifiedLength, length)) {
- XmlDiscriminatorColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedLength_(length);
- xmlColumn.setLength(length);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedLength_(Integer length) {
- Integer old = this.specifiedLength;
- this.specifiedLength = length;
- this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
- }
-
- protected Integer buildSpecifiedLength() {
- XmlDiscriminatorColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getLength();
- }
-
- public int getDefaultLength() {
- return this.defaultLength;
- }
-
- protected void setDefaultLength(int defaultLength) {
- int old = this.defaultLength;
- this.defaultLength = defaultLength;
- this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, defaultLength);
- }
-
- protected int buildDefaultLength() {
- return this.owner.getDefaultLength();
- }
-
-
- // ********** validation **********
-
- public boolean isResourceSpecified() {
- return this.getXmlColumn() != null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java
deleted file mode 100644
index 9ecf827277..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEmbeddable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
-
-/**
- * <code>orm.xml</code> embeddable type mapping
- */
-public class GenericOrmEmbeddable
- extends AbstractOrmEmbeddable<XmlEmbeddable>
-{
- public GenericOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
- super(parent, resourceMapping);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return ArrayTools.contains(GenericJavaEmbeddable.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
deleted file mode 100644
index 51937340cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java
+++ /dev/null
@@ -1,160 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedIdMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> embedded ID mapping
- */
-public class GenericOrmEmbeddedIdMapping
- extends AbstractOrmBaseEmbeddedMapping<XmlEmbeddedId>
- implements EmbeddedIdMapping2_0, OrmEmbeddedIdMapping
-{
- /* JPA 2.0 - the embedded id may be derived from a relationship */
- protected boolean derived;
-
-
- public GenericOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId xmlMapping) {
- super(parent, xmlMapping);
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.setMappedByRelationship(this.buildDerived());
- }
-
-
- // ********** derived **********
-
- public boolean isDerived() {
- return this.derived;
- }
-
- protected void setMappedByRelationship(boolean derived) {
- boolean old = this.derived;
- this.derived = derived;
- this.firePropertyChanged(DERIVED_PROPERTY, old, derived);
- }
-
- protected boolean buildDerived() {
- return this.isJpa2_0Compatible() && this.buildDerived_();
- }
-
- protected boolean buildDerived_() {
- return this.getTypeMapping().attributeIsDerivedId(this.name);
- }
-
-
- // ********** 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 Iterable<String> getEmbeddableOverridableAttributeMappingNames() {
- return this.derived ?
- EmptyIterable.<String>instance() :
- super.getEmbeddableOverridableAttributeMappingNames();
- }
-
- @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.derived
- && (this.attributeOverrideContainer.getSpecifiedOverridesSize() > 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 Iterable<String> getAllOverridableNames() {
- return GenericOrmEmbeddedIdMapping.this.isDerived() ?
- EmptyIterable.<String>instance() :
- super.getAllOverridableNames();
- }
-
- /**
- * pre-condition: type mapping is not <code>null</code>
- */
- @Override
- protected Iterable<String> getAllOverridableAttributeNames_(TypeMapping overriddenTypeMapping) {
- return new FilteringIterable<String>(super.getAllOverridableAttributeNames_(overriddenTypeMapping)) {
- @Override
- protected boolean accept(String attributeName) {
- return ! AttributeOverrideContainerOwner.this.getTypeMapping().attributeIsDerivedId(attributeName);
- }
- };
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
deleted file mode 100644
index 91ea572a05..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java
+++ /dev/null
@@ -1,311 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AssociationOverride;
-import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> embedded mapping
- */
-public class GenericOrmEmbeddedMapping
- extends AbstractOrmBaseEmbeddedMapping<XmlEmbedded>
- implements OrmEmbeddedMapping2_0
-{
- protected final OrmAssociationOverrideContainer associationOverrideContainer;
-
-
- public GenericOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded xmlMapping) {
- super(parent, xmlMapping);
- this.associationOverrideContainer = this.buildAssociationOverrideContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.associationOverrideContainer.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.associationOverrideContainer.update();
- }
-
-
- // ********** association override container **********
-
- public OrmAssociationOverrideContainer getAssociationOverrideContainer() {
- return this.associationOverrideContainer;
- }
-
- protected OrmAssociationOverrideContainer buildAssociationOverrideContainer() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmAssociationOverrideContainer(this, this.buildAssociationOverrideContainerOwner()) :
- new GenericOrmAssociationOverrideContainer(this, null);
- }
-
- protected OrmAssociationOverrideContainer2_0.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 Iterable<String> getAllMappingNames() {
- return this.isJpa2_0Compatible() ?
- new CompositeIterable<String>(super.getAllMappingNames(), this.getAllEmbeddableAttributeMappingNames()) :
- super.getAllMappingNames();
- }
-
- protected Iterable<String> getAllEmbeddableAttributeMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<RelationshipMapping> allOverridableAssociations() {
- return (this.targetEmbeddable != null) ?
- new SubIterableWrapper<AttributeMapping, RelationshipMapping>(this.getAllOverridableAssociations_()) :
- EmptyIterable.<RelationshipMapping>instance();
- }
-
- protected Iterable<AttributeMapping> getAllOverridableAssociations_() {
- return new FilteringIterable<AttributeMapping>(this.targetEmbeddable.getAttributeMappings()) {
- @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 : this.getEmbeddableAttributeMappings()) {
- 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;
- }
-
- 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);
- }
-
- @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);
- }
-
- @Override
- protected OrmAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() {
- return new AttributeOverrideContainerOwner();
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateOverrides(List<IMessage> messages, IReporter reporter) {
- super.validateOverrides(messages, reporter);
- this.associationOverrideContainer.validate(messages, reporter);
- }
-
-
- // ********** attribute override container owner *********
-
- protected class AttributeOverrideContainerOwner
- extends AbstractOrmBaseEmbeddedMapping<XmlEmbedded>.AttributeOverrideContainerOwner
- {
- // nothing yet
- }
-
-
- // ********** association override container owner **********
-
- protected class AssociationOverrideContainerOwner
- implements OrmAssociationOverrideContainer2_0.Owner
- {
- protected String getMappingName() {
- return GenericOrmEmbeddedMapping.this.getName();
- }
-
- public OrmTypeMapping getTypeMapping() {
- return GenericOrmEmbeddedMapping.this.getTypeMapping();
- }
-
- public TypeMapping getOverridableTypeMapping() {
- return GenericOrmEmbeddedMapping.this.getTargetEmbeddable();
- }
-
- public Iterable<String> getAllOverridableNames() {
- TypeMapping typeMapping = this.getOverridableTypeMapping();
- return (typeMapping != null) ? typeMapping.getAllOverridableAssociationNames() : EmptyIterable.<String>instance();
- }
-
- public Iterable<String> getJavaOverrideNames() {
- return null;
- }
-
- 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 Iterable<String> getCandidateTableNames() {
- return this.getTypeMapping().getAllAssociatedTableNames();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getTypeMapping().getPrimaryTableName();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmEmbeddedMapping.this.getValidationTextRange();
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AssociationOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyAssociationOverride) override, (ReadOnlyJoinColumn) column, (ReadOnlyJoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideInverseJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinTableValidator(this.getPersistentAttribute(), override, (ReadOnlyJoinTable) table, textRangeResolver);
- }
-
- protected OrmPersistentAttribute getPersistentAttribute() {
- return GenericOrmEmbeddedMapping.this.getPersistentAttribute();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java
deleted file mode 100644
index 839ccc846d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java
+++ /dev/null
@@ -1,82 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEntity;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
-
-public class GenericOrmEntity
- extends AbstractOrmEntity<XmlEntity>
-{
- // EclipseLink holds its cacheable in its caching
- protected final OrmCacheable2_0 cacheable;
-
-
- public GenericOrmEntity(OrmPersistentType parent, XmlEntity xmlEntity) {
- super(parent, xmlEntity);
- this.cacheable = this.buildCacheable();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.cacheable.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.cacheable.update();
- }
-
-
- // ********** cacheable **********
-
- public OrmCacheable2_0 getCacheable() {
- return this.cacheable;
- }
-
- protected OrmCacheable2_0 buildCacheable() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmCacheable(this) :
- new NullOrmCacheable2_0(this);
- }
-
- public boolean calculateDefaultCacheable() {
- CacheableHolder2_0 javaEntity = (CacheableHolder2_0) this.getJavaTypeMappingForDefaults();
- if (javaEntity != null) {
- return javaEntity.getCacheable().isCacheable();
- }
-
- Cacheable2_0 parentCacheable = this.getParentCacheable();
- return (parentCacheable != null) ?
- parentCacheable.isCacheable() :
- ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable();
- }
-
- protected Cacheable2_0 getParentCacheable() {
- CacheableHolder2_0 parentEntity = (CacheableHolder2_0) this.getParentEntity();
- return (parentEntity == null) ? null : parentEntity.getCacheable();
- }
-
- public XmlCacheable_2_0 getXmlCacheable() {
- return this.getXmlTypeMapping();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
deleted file mode 100644
index 06bfd06add..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java
+++ /dev/null
@@ -1,135 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.EnumType;
-import org.eclipse.jpt.jpa.core.context.EnumeratedConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class GenericOrmEnumeratedConverter
- extends AbstractOrmConverter
- implements OrmEnumeratedConverter
-{
- protected EnumType specifiedEnumType;
- protected EnumType defaultEnumType;
-
-
- public GenericOrmEnumeratedConverter(OrmAttributeMapping parent) {
- super(parent);
- this.specifiedEnumType = this.buildSpecifiedEnumType();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedEnumType_(this.buildSpecifiedEnumType());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultEnumType(this.buildDefaultEnumType());
- }
-
-
- // ********** enum type **********
-
- public EnumType getEnumType() {
- return (this.specifiedEnumType != null) ? this.specifiedEnumType : this.getDefaultEnumType();
- }
-
- public EnumType getSpecifiedEnumType() {
- return this.specifiedEnumType;
- }
-
- public void setSpecifiedEnumType(EnumType enumType) {
- this.setSpecifiedEnumType_(enumType);
- this.setXmlEnumerated(enumType);
- }
-
- protected void setSpecifiedEnumType_(EnumType enumType) {
- EnumType old = this.specifiedEnumType;
- this.specifiedEnumType = enumType;
- this.firePropertyChanged(SPECIFIED_ENUM_TYPE_PROPERTY, old, enumType);
- }
-
- protected void setXmlEnumerated(EnumType enumType) {
- this.getXmlConvertibleMapping().setEnumerated(EnumType.toOrmResourceModel(enumType));
- }
-
- protected EnumType buildSpecifiedEnumType() {
- return EnumType.fromOrmResourceModel(this.getXmlConvertibleMapping().getEnumerated());
- }
-
- public EnumType getDefaultEnumType() {
- return this.defaultEnumType;
- }
-
- protected void setDefaultEnumType(EnumType enumType) {
- EnumType old = this.defaultEnumType;
- this.defaultEnumType = enumType;
- this.firePropertyChanged(DEFAULT_ENUM_TYPE_PROPERTY, old, enumType);
- }
-
- /**
- * There is no default enum type in XML.
- * If you specify the enumerated element, you must
- * specify either {@link EnumType#ORDINAL} or
- * {@link EnumType#STRING}.
- */
- protected EnumType buildDefaultEnumType() {
- return null;
- }
-
-
- // ********** misc **********
-
- public Class<? extends Converter> getType() {
- return EnumeratedConverter.class;
- }
-
- public void initialize() {
- this.specifiedEnumType = DEFAULT_ENUM_TYPE;
- this.setXmlEnumerated(this.specifiedEnumType);
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-
-
- // ********** validation **********
-
- @Override
- protected TextRange getXmlValidationTextRange() {
- return this.getXmlConvertibleMapping().getEnumeratedTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
deleted file mode 100644
index b97f0016de..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java
+++ /dev/null
@@ -1,192 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.GenerationType;
-import org.eclipse.jpt.jpa.core.context.Generator;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> generated value
- */
-public class GenericOrmGeneratedValue
- extends AbstractOrmXmlContextNode
- implements OrmGeneratedValue
-{
- protected final XmlGeneratedValue xmlGeneratedValue;
-
- protected GenerationType specifiedStrategy;
- protected GenerationType defaultStrategy;
-
- protected String specifiedGenerator;
- protected String defaultGenerator;
-
-
- public GenericOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue xmlGeneratedValue) {
- super(parent);
- this.xmlGeneratedValue = xmlGeneratedValue;
- this.specifiedStrategy = this.buildSpecifiedStrategy();
- this.specifiedGenerator = xmlGeneratedValue.getGenerator();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedStrategy_(this.buildSpecifiedStrategy());
- this.setSpecifiedGenerator_(this.xmlGeneratedValue.getGenerator());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultStrategy(this.buildDefaultStrategy());
- this.setDefaultGenerator(this.buildDefaultGenerator());
- }
-
-
- // ********** strategy **********
-
- public GenerationType getStrategy() {
- return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.defaultStrategy;
- }
-
- public GenerationType getSpecifiedStrategy() {
- return this.specifiedStrategy;
- }
-
- public void setSpecifiedStrategy(GenerationType strategy) {
- this.setSpecifiedStrategy_(strategy);
- this.xmlGeneratedValue.setStrategy(GenerationType.toOrmResourceModel(strategy));
- }
-
- protected void setSpecifiedStrategy_(GenerationType strategy) {
- GenerationType old = this.specifiedStrategy;
- this.specifiedStrategy = strategy;
- this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy);
- }
-
- protected GenerationType buildSpecifiedStrategy() {
- return GenerationType.fromOrmResourceModel(this.xmlGeneratedValue.getStrategy());
- }
-
- public GenerationType getDefaultStrategy() {
- return this.defaultStrategy;
- }
-
- protected void setDefaultStrategy(GenerationType strategy) {
- GenerationType old = this.defaultStrategy;
- this.defaultStrategy = strategy;
- this.firePropertyChanged(DEFAULT_STRATEGY_PROPERTY, old, strategy);
- }
-
- // TODO
- protected GenerationType buildDefaultStrategy() {
- return DEFAULT_STRATEGY;
- }
-
-
- // ********** generator **********
-
- public String getGenerator() {
- return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator;
- }
-
- public String getSpecifiedGenerator() {
- return this.specifiedGenerator;
- }
-
- public void setSpecifiedGenerator(String generator) {
- this.setSpecifiedGenerator_(generator);
- this.xmlGeneratedValue.setGenerator(generator);
- }
-
- protected void setSpecifiedGenerator_(String generator) {
- String old = this.specifiedGenerator;
- this.specifiedGenerator = generator;
- this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator);
- }
-
- public String getDefaultGenerator() {
- return this.defaultGenerator;
- }
-
- protected void setDefaultGenerator(String generator) {
- String old = this.defaultGenerator;
- this.defaultGenerator = generator;
- this.firePropertyChanged(DEFAULT_GENERATOR_PROPERTY, old, generator);
- }
-
- // TODO
- protected String buildDefaultGenerator() {
- return null;
- }
-
-
- // ********** 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 (Generator next : this.getPersistenceUnit().getGenerators()) {
- if (generator.equals(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 textRange = this.xmlGeneratedValue.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
- public TextRange getGeneratorTextRange() {
- return this.getValidationTextRange(this.xmlGeneratedValue.getGeneratorTextRange());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
deleted file mode 100644
index 07d580f8df..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java
+++ /dev/null
@@ -1,218 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmGeneratorContainer
- extends AbstractOrmXmlContextNode
- implements OrmGeneratorContainer
-{
- protected final XmlGeneratorContainer xmlGeneratorContainer;
-
- protected OrmSequenceGenerator sequenceGenerator;
-
- protected OrmTableGenerator tableGenerator;
-
-
- public GenericOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer xmlGeneratorContainer) {
- super(parent);
- this.xmlGeneratorContainer = xmlGeneratorContainer;
- this.sequenceGenerator = this.buildSequenceGenerator();
- this.tableGenerator = this.buildTableGenerator();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncSequenceGenerator();
- this.syncTableGenerator();
- }
-
- @Override
- public void update() {
- super.update();
- if (this.sequenceGenerator != null) {
- this.sequenceGenerator.update();
- }
- if (this.tableGenerator != null) {
- this.tableGenerator.update();
- }
- }
-
-
- // ********** sequence generator **********
-
- public OrmSequenceGenerator getSequenceGenerator() {
- return this.sequenceGenerator;
- }
-
- public OrmSequenceGenerator addSequenceGenerator() {
- if (this.sequenceGenerator != null) {
- throw new IllegalStateException("sequence generator already exists: " + this.sequenceGenerator); //$NON-NLS-1$
- }
- XmlSequenceGenerator xmlGenerator = this.buildXmlSequenceGenerator();
- OrmSequenceGenerator generator = this.buildSequenceGenerator(xmlGenerator);
- this.setSequenceGenerator_(generator);
- this.xmlGeneratorContainer.setSequenceGenerator(xmlGenerator);
- return generator;
- }
-
- protected XmlSequenceGenerator buildXmlSequenceGenerator() {
- return OrmFactory.eINSTANCE.createXmlSequenceGenerator();
- }
-
- public void removeSequenceGenerator() {
- if (this.sequenceGenerator == null) {
- throw new IllegalStateException("sequence generator does not exist"); //$NON-NLS-1$
- }
- this.setSequenceGenerator_(null);
- this.xmlGeneratorContainer.setSequenceGenerator(null);
- }
-
- protected OrmSequenceGenerator buildSequenceGenerator() {
- XmlSequenceGenerator xmlGenerator = this.getXmlSequenceGenerator();
- return (xmlGenerator == null) ? null : this.buildSequenceGenerator(xmlGenerator);
- }
-
- protected XmlSequenceGenerator getXmlSequenceGenerator() {
- return this.xmlGeneratorContainer.getSequenceGenerator();
- }
-
- protected OrmSequenceGenerator buildSequenceGenerator(XmlSequenceGenerator xmlSequenceGenerator) {
- return this.getContextNodeFactory().buildOrmSequenceGenerator(this, xmlSequenceGenerator);
- }
-
- protected void syncSequenceGenerator() {
- XmlSequenceGenerator xmlGenerator = this.getXmlSequenceGenerator();
- if (xmlGenerator == null) {
- if (this.sequenceGenerator != null) {
- this.setSequenceGenerator_(null);
- }
- } else {
- if ((this.sequenceGenerator != null) && (this.sequenceGenerator.getXmlGenerator() == xmlGenerator)) {
- this.sequenceGenerator.synchronizeWithResourceModel();
- } else {
- this.setSequenceGenerator_(this.buildSequenceGenerator(xmlGenerator));
- }
- }
- }
-
- protected void setSequenceGenerator_(OrmSequenceGenerator sequenceGenerator) {
- OrmSequenceGenerator old = this.sequenceGenerator;
- this.sequenceGenerator = sequenceGenerator;
- this.firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, old, sequenceGenerator);
- }
-
-
- // ********** table generator **********
-
- public OrmTableGenerator getTableGenerator() {
- return this.tableGenerator;
- }
-
- public OrmTableGenerator addTableGenerator() {
- if (this.tableGenerator != null) {
- throw new IllegalStateException("table generator already exists: " + this.tableGenerator); //$NON-NLS-1$
- }
- XmlTableGenerator xmlGenerator = this.buildXmlTableGenerator();
- OrmTableGenerator generator = this.buildTableGenerator(xmlGenerator);
- this.setTableGenerator_(generator);
- this.xmlGeneratorContainer.setTableGenerator(xmlGenerator);
- return generator;
- }
-
- protected XmlTableGenerator buildXmlTableGenerator() {
- return OrmFactory.eINSTANCE.createXmlTableGenerator();
- }
-
- public void removeTableGenerator() {
- if (this.tableGenerator == null) {
- throw new IllegalStateException("table generator does not exist"); //$NON-NLS-1$
- }
- this.setTableGenerator_(null);
- this.xmlGeneratorContainer.setTableGenerator(null);
- }
-
- protected OrmTableGenerator buildTableGenerator() {
- XmlTableGenerator xmlGenerator = this.getXmlTableGenerator();
- return (xmlGenerator == null) ? null : this.buildTableGenerator(xmlGenerator);
- }
-
- protected XmlTableGenerator getXmlTableGenerator() {
- return this.xmlGeneratorContainer.getTableGenerator();
- }
-
- protected OrmTableGenerator buildTableGenerator(XmlTableGenerator xmlTableGenerator) {
- return this.getContextNodeFactory().buildOrmTableGenerator(this, xmlTableGenerator);
- }
-
- protected void syncTableGenerator() {
- XmlTableGenerator xmlGenerator = this.getXmlTableGenerator();
- if (xmlGenerator == null) {
- if (this.tableGenerator != null) {
- this.setTableGenerator_(null);
- }
- } else {
- if ((this.tableGenerator != null) && (this.tableGenerator.getXmlGenerator() == xmlGenerator)) {
- this.tableGenerator.synchronizeWithResourceModel();
- } else {
- this.setTableGenerator_(this.buildTableGenerator(xmlGenerator));
- }
- }
- }
-
- protected void setTableGenerator_(OrmTableGenerator tableGenerator) {
- OrmTableGenerator old = this.tableGenerator;
- this.tableGenerator = tableGenerator;
- this.firePropertyChanged(TABLE_GENERATOR_PROPERTY, old, tableGenerator);
- }
-
-
- // ********** validation **********
-
- /**
- * The generators are validated in the persistence unit.
- * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateGenerators(List, IReporter)
- */
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // generators are validated in the persistence unit
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlGeneratorContainer.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java
deleted file mode 100644
index 958b87ddf5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmIdMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlId;
-
-/**
- * <code>orm.xml</code> ID mapping
- */
-public class GenericOrmIdMapping
- extends AbstractOrmIdMapping<XmlId>
-{
- public GenericOrmIdMapping(OrmPersistentAttribute parent, XmlId xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
deleted file mode 100644
index 756d1cc4ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java
+++ /dev/null
@@ -1,185 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * <code>orm.xml</code> join column
- */
-public class GenericOrmJoinColumn
- extends AbstractOrmBaseColumn<XmlJoinColumn, OrmReadOnlyJoinColumn.Owner>
- implements OrmJoinColumn
-{
- /** @see org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn) */
- protected /* final */ XmlJoinColumn xmlColumn; // null for default join columns
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericOrmJoinColumn(XmlContextNode parent, OrmReadOnlyJoinColumn.Owner owner) {
- this(parent, owner, null);
- }
-
- public GenericOrmJoinColumn(XmlContextNode parent, OrmReadOnlyJoinColumn.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);
- }
-
-
- // ********** validation **********
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.getValidationTextRange(this.xmlColumn.getReferencedColumnNameTextRange());
- }
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver() {
- return new OrmJoinColumnTextRangeResolver(this);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
deleted file mode 100644
index d83705a457..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java
+++ /dev/null
@@ -1,467 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> join table
- */
-public class GenericOrmJoinTable
- extends GenericOrmReferenceTable<XmlJoinTable>
- implements OrmJoinTable
-{
- protected final ContextListContainer<OrmJoinColumn, XmlJoinColumn> specifiedInverseJoinColumnContainer;
- protected final OrmReadOnlyJoinColumn.Owner inverseJoinColumnOwner;
-
- protected OrmJoinColumn defaultInverseJoinColumn;
-
-
- public GenericOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Owner owner) {
- super(parent, owner);
- this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner();
- this.specifiedInverseJoinColumnContainer = this.buildSpecifiedInverseJoinColumnContainer();
- }
-
- @Override
- protected OrmReadOnlyJoinColumn.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.getRelationshipStrategy().getXmlJoinTable();
- }
-
- @Override
- protected XmlJoinTable buildXmlTable() {
- return this.getRelationshipStrategy().buildXmlJoinTable();
- }
-
- @Override
- protected void removeXmlTable() {
- this.getRelationshipStrategy().removeXmlJoinTable();
- }
-
-
- // ********** inverse join columns **********
-
- public ListIterable<OrmJoinColumn> getInverseJoinColumns() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns();
- }
-
- public int getInverseJoinColumnsSize() {
- return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize();
- }
-
- public void convertDefaultInverseJoinColumnToSpecified() {
- MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this);
- }
-
-
- // ********** specified inverse join columns **********
-
- public ListIterable<OrmJoinColumn> getSpecifiedInverseJoinColumns() {
- return this.specifiedInverseJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedInverseJoinColumnsSize() {
- return this.specifiedInverseJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedInverseJoinColumns() {
- return this.getSpecifiedInverseJoinColumnsSize() != 0;
- }
-
- public OrmJoinColumn getSpecifiedInverseJoinColumn(int index) {
- return this.specifiedInverseJoinColumnContainer.getContextElement(index);
- }
-
- public OrmJoinColumn addSpecifiedInverseJoinColumn() {
- return this.addSpecifiedInverseJoinColumn(this.getSpecifiedInverseJoinColumnsSize());
- }
-
- public OrmJoinColumn addSpecifiedInverseJoinColumn(int index) {
- XmlJoinTable xmlTable = this.getXmlTableForUpdate();
- XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
- OrmJoinColumn joinColumn = this.specifiedInverseJoinColumnContainer.addContextElement(index, xmlJoinColumn);
- xmlTable.getInverseJoinColumns().add(index, xmlJoinColumn);
- return joinColumn;
- }
-
- public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumnContainer.indexOfContextElement((OrmJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedInverseJoinColumn(int index) {
- this.specifiedInverseJoinColumnContainer.removeContextElement(index);
- this.getXmlTable().getInverseJoinColumns().remove(index);
- this.removeXmlTableIfUnset();
- }
-
- public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) {
- this.specifiedInverseJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- this.getXmlTable().getInverseJoinColumns().move(targetIndex, sourceIndex);
- }
-
- public void clearSpecifiedInverseJoinColumns() {
- this.specifiedInverseJoinColumnContainer.clearContextList();
- this.getXmlTable().getInverseJoinColumns().clear();
- }
-
- protected void syncSpecifiedInverseJoinColumns() {
- this.specifiedInverseJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlJoinColumn> getXmlInverseJoinColumns() {
- XmlJoinTable xmlTable = this.getXmlTable();
- return (xmlTable == null) ?
- EmptyListIterable.<XmlJoinColumn>instance() :
- // clone to reduce chance of concurrency problems
- new LiveCloneListIterable<XmlJoinColumn>(xmlTable.getInverseJoinColumns());
- }
-
- protected ContextListContainer<OrmJoinColumn, XmlJoinColumn> buildSpecifiedInverseJoinColumnContainer() {
- return new SpecifiedInverseJoinColumnContainer();
- }
-
- /**
- * specified inverse join column container
- */
- protected class SpecifiedInverseJoinColumnContainer
- extends ContextListContainer<OrmJoinColumn, XmlJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_INVERSE_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmJoinColumn buildContextElement(XmlJoinColumn resourceElement) {
- return GenericOrmJoinTable.this.buildInverseJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<XmlJoinColumn> getResourceElements() {
- return GenericOrmJoinTable.this.getXmlInverseJoinColumns();
- }
- @Override
- protected XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- }
-
- protected OrmReadOnlyJoinColumn.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 getRelationshipStrategy() {
- return this.getParent();
- }
-
- @Override
- protected String buildDefaultName() {
- return this.getRelationshipStrategy().getJoinTableDefaultName();
- }
-
- public void initializeFrom(ReadOnlyJoinTable oldTable) {
- super.initializeFrom(oldTable);
- for (ReadOnlyJoinColumn joinColumn : oldTable.getSpecifiedInverseJoinColumns()) {
- this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn);
- }
- }
-
- public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) {
- super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : virtualTable.getInverseJoinColumns()) {
- this.addSpecifiedInverseJoinColumn().initializeFromVirtual(joinColumn);
- }
- }
-
- protected OrmJoinColumn buildInverseJoinColumn(XmlJoinColumn xmlJoinColumn) {
- return this.getContextNodeFactory().buildOrmJoinColumn(this, this.inverseJoinColumnOwner, xmlJoinColumn);
- }
-
- public RelationshipMapping getRelationshipMapping() {
- return this.getRelationshipStrategy().getRelationship().getMapping();
- }
-
- public PersistentAttribute getPersistentAttribute() {
- return this.getRelationshipMapping().getPersistentAttribute();
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateJoinColumns(List<IMessage> messages, IReporter reporter) {
- super.validateJoinColumns(messages, reporter);
- this.validateNodes(this.getInverseJoinColumns(), messages, reporter);
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationshipStrategy().validatesAgainstDatabase();
- }
-
-
- // ********** join column owners **********
-
- /**
- * just a little common behavior
- */
- protected abstract class AbstractJoinColumnOwner
- implements OrmReadOnlyJoinColumn.Owner
- {
- protected AbstractJoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getRelationship().getTypeMapping();
- }
-
- /**
- * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner)
- */
- public String getDefaultColumnName() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * If there is a specified table name it needs to be the same
- * the default table name. The table is always the join table.
- */
- public boolean tableNameIsInvalid(String tableName) {
- return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName);
- }
-
- /**
- * the join column can only be on the join table itself
- */
- public Iterable<String> getCandidateTableNames() {
- return EmptyIterable.instance();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return Tools.valuesAreEqual(GenericOrmJoinTable.this.getName(), tableName) ?
- GenericOrmJoinTable.this.getDbTable() :
- null;
- }
-
- /**
- * by default, the join column is, obviously, in the join table;
- * not sure whether it can be anywhere else...
- */
- public String getDefaultTableName() {
- return GenericOrmJoinTable.this.getName();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmJoinTable.this.getValidationTextRange();
- }
-
- protected OrmRelationship getRelationship() {
- return this.getRelationshipStrategy().getRelationship();
- }
-
- protected OrmJoinTableRelationshipStrategy getRelationshipStrategy() {
- return GenericOrmJoinTable.this.getRelationshipStrategy();
- }
- }
-
-
- /**
- * 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(GenericOrmJoinTable.this.getRelationshipMapping());
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName);
- return (dbTable != null) ? dbTable : this.getTypeMapping().resolveDbTable(tableName);
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmJoinTable.this.defaultJoinColumn == joinColumn;
- }
-
- public int getJoinColumnsSize() {
- return GenericOrmJoinTable.this.getJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getRelationshipStrategy().buildJoinTableJoinColumnValidator((ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-
-
- /**
- * owner for "forward-pointer" join columns;
- * these point at the target/inverse entity
- */
- protected class InverseJoinColumnOwner
- extends AbstractJoinColumnOwner
- {
- protected InverseJoinColumnOwner() {
- super();
- }
-
- public Entity getRelationshipTarget() {
- RelationshipMapping relationshipMapping = GenericOrmJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity();
- }
-
- public String getAttributeName() {
- RelationshipMapping relationshipMapping = GenericOrmJoinTable.this.getRelationshipMapping();
- return (relationshipMapping == null) ? null : relationshipMapping.getName();
- }
-
- @Override
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName);
- if (dbTable != null) {
- return dbTable;
- }
- Entity relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.resolveDbTable(tableName);
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- Entity relationshipTarget = this.getRelationshipTarget();
- return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmJoinTable.this.defaultInverseJoinColumn == joinColumn;
- }
-
- public int getJoinColumnsSize() {
- return GenericOrmJoinTable.this.getInverseJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getRelationshipStrategy().buildJoinTableInverseJoinColumnValidator((ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
deleted file mode 100644
index 94c52ecc93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.LobConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class GenericOrmLobConverter
- extends AbstractOrmConverter
- implements OrmLobConverter
-{
- public GenericOrmLobConverter(OrmAttributeMapping parent) {
- super(parent);
- }
-
-
- // ********** misc **********
-
- public Class<? extends Converter> getType() {
- return LobConverter.class;
- }
-
- public void initialize() {
- this.getXmlConvertibleMapping().setLob(true);
- }
-
-
- // ********** validation **********
-
- @Override
- protected TextRange getXmlValidationTextRange() {
- return this.getXmlConvertibleMapping().getLobTextRange();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java
deleted file mode 100644
index 6a002b3d2e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToManyMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany;
-
-public class GenericOrmManyToManyMapping
- extends AbstractOrmManyToManyMapping<XmlManyToMany>
-{
- public GenericOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java
deleted file mode 100644
index 740c4e01e3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToOneMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne;
-
-public class GenericOrmManyToOneMapping
- extends AbstractOrmManyToOneMapping<XmlManyToOne>
-{
- public GenericOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java
deleted file mode 100644
index 45014549d5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmMappedSuperclass;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass;
-
-/**
- * <code>orm.xml</code> mapped superclass
- */
-public class GenericOrmMappedSuperclass
- extends AbstractOrmMappedSuperclass<XmlMappedSuperclass>
-{
- public GenericOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) {
- super(parent, resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
deleted file mode 100644
index 9fd7ad9075..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
+++ /dev/null
@@ -1,95 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <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);
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateQuery_(List<IMessage> messages, IReporter reporter) {
- // nothing yet
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
deleted file mode 100644
index be9134eeab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java
+++ /dev/null
@@ -1,43 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> named query
- */
-public class GenericOrmNamedQuery
- extends AbstractOrmQuery<XmlNamedQuery>
- implements OrmNamedQuery
-{
- public GenericOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
- super(parent, resourceNamedQuery);
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateQuery_(java.util.List<IMessage> messages, IReporter reporter) {
- // Convert the literal escape characters into actual escape characters
- String jpqlQuery = ExpressionTools.unescape(this.query, new int[1]);
-
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
- helper.validate(this, jpqlQuery, this.getQueryTextRange(), 0, messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java
deleted file mode 100644
index 374f84e338..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
-
-/**
- * <code>orm.xml</code> null attribute mapping
- */
-public class GenericOrmNullAttributeMapping
- extends AbstractOrmAttributeMapping<XmlNullAttributeMapping>
-{
- public GenericOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping xmlMapping) {
- super(parent, xmlMapping);
- }
-
- public String getKey() {
- return null;
- }
-
- public int getXmlSequence() {
- return -1;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmAttributeMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
- throw new UnsupportedOperationException();
- }
-
- public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
- throw new UnsupportedOperationException();
- }
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java
deleted file mode 100644
index 4fdad7ce7b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToManyMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany;
-
-public class GenericOrmOneToManyMapping
- extends AbstractOrmOneToManyMapping<XmlOneToMany>
-{
- public GenericOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java
deleted file mode 100644
index e89cef7e89..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToOneMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne;
-
-/**
- * <code>orm.xml</code> 1:1 mapping
- */
-public class GenericOrmOneToOneMapping
- extends AbstractOrmOneToOneMapping<XmlOneToOne>
-{
- public GenericOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
deleted file mode 100644
index 3fb9fec821..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java
+++ /dev/null
@@ -1,450 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.OrderColumnValidator;
-import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> ordering
- * <p>
- * <strong>NB:</strong> Setting any flag to <code>false</code> (or setting the
- * specified "order by" to <code>null</code>) can be a bit unpredictable. The
- * intent is to set a flag to <code>true</code> (or set the specified "order by"
- * to a non-<code>null</code> value).
- * <p>
- * <strong>(JPA 2.0 only) NB:</strong> If both the "order-by" and the
- * "order-column" elements are present (which is prohibited by the JPA spec),
- * both are ignored.
- */
-public class GenericOrmOrderable
- extends AbstractOrmXmlContextNode
- implements OrmOrderable2_0
-{
- protected String specifiedOrderBy;
- protected boolean noOrdering = false;
- protected boolean pkOrdering = false;
- protected boolean customOrdering = false;
-
- // JPA 2.0
- protected final Owner owner; // this is null for JPA 1.0 mappings
- protected boolean orderColumnOrdering = false;
- protected final OrmOrderColumn2_0 orderColumn; // this is null for JPA 1.0 mappings
-
-
- /**
- * JPA 1.0
- */
- public GenericOrmOrderable(OrmAttributeMapping parent) {
- this(parent, null);
- }
-
- /**
- * JPA 2.0
- */
- public GenericOrmOrderable(OrmAttributeMapping parent, Owner owner) {
- super(parent);
-
- this.specifiedOrderBy = this.buildSpecifiedOrderBy();
- this.noOrdering = this.buildNoOrdering();
- this.pkOrdering = this.buildPkOrdering();
- this.customOrdering = this.buildCustomOrdering();
-
- this.owner = owner;
- this.orderColumnOrdering = this.buildOrderColumnOrdering();
- this.orderColumn = this.buildOrderColumn();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
-
- this.setSpecifiedOrderBy_(this.buildSpecifiedOrderBy());
- this.setNoOrdering_(this.buildNoOrdering());
- this.setPkOrdering_(this.buildPkOrdering());
- this.setCustomOrdering_(this.buildCustomOrdering());
-
- this.setOrderColumnOrdering_(this.buildOrderColumnOrdering());
- if (this.orderColumn != null) {
- this.orderColumn.synchronizeWithResourceModel();
- }
- }
-
- @Override
- public void update() {
- super.update();
- if (this.orderColumn != null) {
- this.orderColumn.update();
- }
- }
-
-
- // ********** specified order by **********
-
- public String getSpecifiedOrderBy() {
- return this.specifiedOrderBy;
- }
-
- public void setSpecifiedOrderBy(String orderBy) {
- if (orderBy != null) {
- this.setSpecifiedOrderBy_(orderBy);
- this.setNoOrdering_(false);
- this.setPkOrdering_(orderBy.length() == 0);
- this.setCustomOrdering_(orderBy.length() != 0);
- this.setOrderColumnOrdering_(false);
-
- this.removeXmlOrderColumn();
- this.getXmlOrderable().setOrderBy(orderBy);
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setSpecifiedOrderBy_(String orderBy) {
- String old = this.specifiedOrderBy;
- this.specifiedOrderBy = orderBy;
- this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy);
- }
-
- protected String buildSpecifiedOrderBy() {
- if (this.xmlOrderColumnIsPresent()) {
- return null;
- }
- return this.getXmlOrderBy();
- }
-
-
- // ********** no ordering **********
-
- public boolean isNoOrdering() {
- return this.noOrdering;
- }
-
- public void setNoOrdering(boolean noOrdering) {
- if (noOrdering) {
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(true);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(false);
-
- this.removeXmlOrderColumn();
- this.getXmlOrderable().setOrderBy(null);
- } else {
- this.setPkOrdering(true); // hmmm...
- }
- }
-
- protected void setNoOrdering_(boolean noOrdering) {
- boolean old = this.noOrdering;
- this.noOrdering = noOrdering;
- this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering);
- }
-
- protected boolean buildNoOrdering() {
- return this.isJpa2_0Compatible() ? this.buildNoOrdering2_0() : this.buildNoOrdering1_0();
- }
-
- /**
- * both elements are missing <em>or</em> both are present
- */
- protected boolean buildNoOrdering2_0() {
- boolean orderByMissing = (this.getXmlOrderBy() == null);
- boolean orderByPresent = ! orderByMissing;
- boolean orderColumnMissing = (this.getXmlOrderColumn() == null);
- boolean orderColumnPresent = ! orderColumnMissing;
- return (orderByMissing && orderColumnMissing) || (orderByPresent && orderColumnPresent);
- }
-
- /**
- * the order-by element is missing
- */
- protected boolean buildNoOrdering1_0() {
- return this.getXmlOrderBy() == null;
- }
-
-
- // ********** pk ordering **********
-
- public boolean isPkOrdering() {
- return this.pkOrdering;
- }
-
- public void setPkOrdering(boolean pkOrdering) {
- if (pkOrdering) {
- this.setSpecifiedOrderBy(""); //$NON-NLS-1$
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setPkOrdering_(boolean pkOrdering) {
- boolean old = this.pkOrdering;
- this.pkOrdering = pkOrdering;
- this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering);
- }
-
- /**
- * the order-by element is present but no value specified
- */
- protected boolean buildPkOrdering() {
- if (this.xmlOrderColumnIsPresent()) {
- return false;
- }
- String xmlOrderBy = this.getXmlOrderBy();
- return (xmlOrderBy != null) && (xmlOrderBy.length() == 0);
- }
-
-
- // ********** custom ordering **********
-
- public boolean isCustomOrdering() {
- return this.customOrdering;
- }
-
- /**
- * Unfortunately, setting the "custom ordering" flag directly is a bit hacky:
- * The "specified order-by" is initially set to an empty string, which is
- * the same as a "primary key ordering" state....
- */
- public void setCustomOrdering(boolean customOrdering) {
- if (customOrdering) {
- this.setSpecifiedOrderBy_(""); // hmmm... //$NON-NLS-1$
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(true);
- this.setOrderColumnOrdering_(false);
-
- this.removeXmlOrderColumn();
- this.getXmlOrderable().setOrderBy(""); //$NON-NLS-1$
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setCustomOrdering_(boolean customOrdering) {
- boolean old = this.customOrdering;
- this.customOrdering = customOrdering;
- this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering);
- }
-
- /**
- * the order-by element is present and it has a specified value
- */
- protected boolean buildCustomOrdering() {
- if (this.xmlOrderColumnIsPresent()) {
- return false;
- }
- String xmlOrderBy = this.getXmlOrderBy();
- return (xmlOrderBy != null) && (xmlOrderBy.length() != 0);
- }
-
-
- // ********** order column ordering **********
-
- public boolean isOrderColumnOrdering() {
- return this.orderColumnOrdering;
- }
-
- public void setOrderColumnOrdering(boolean orderColumnOrdering) {
- if (orderColumnOrdering) {
- this.setSpecifiedOrderBy_(null);
- this.setNoOrdering_(false);
- this.setPkOrdering_(false);
- this.setCustomOrdering_(false);
- this.setOrderColumnOrdering_(true);
-
- this.getXmlOrderable().setOrderBy(null);
- this.buildXmlOrderColumn();
- } else {
- this.setNoOrdering(true); // hmmm...
- }
- }
-
- protected void setOrderColumnOrdering_(boolean orderColumnOrdering) {
- boolean old = this.orderColumnOrdering;
- this.orderColumnOrdering = orderColumnOrdering;
- this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering);
- }
-
- /**
- * JPA 2.0 only;
- * the <code>order-column</code> element is present <em>and</em>
- * the <code>order-by</code> element is missing
- */
- protected boolean buildOrderColumnOrdering() {
- return this.xmlOrderColumnIsPresent() &&
- (this.getXmlOrderBy() == null);
- }
-
-
- // ********** order column **********
-
- public OrmOrderColumn2_0 getOrderColumn() {
- return this.orderColumn;
- }
-
- /**
- * JPA 2.0 only
- */
- protected OrmOrderColumn2_0 buildOrderColumn() {
- return this.isOrmXml2_0Compatible() ?
- this.getContextNodeFactory2_0().buildOrmOrderColumn(this, new OrderColumnOwner()) :
- null;
- }
-
-
- // ********** 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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new OrderColumnValidator(this.getPersistentAttribute(), (OrderColumn2_0) column, textRangeResolver);
- }
-
- public XmlOrderColumn getXmlColumn() {
- return GenericOrmOrderable.this.getXmlOrderColumn();
- }
-
- public XmlOrderColumn buildXmlColumn() {
- return GenericOrmOrderable.this.buildXmlOrderColumn();
- }
-
- public void removeXmlColumn() {
- GenericOrmOrderable.this.removeXmlOrderColumn();
- }
-
- protected OrmPersistentAttribute getPersistentAttribute() {
- return GenericOrmOrderable.this.getPersistentAttribute();
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
deleted file mode 100644
index 8ab30f8a51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java
+++ /dev/null
@@ -1,308 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.MappedByRelationship;
-import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOverrideJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.orm.NullOrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverride2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class 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() {
- return this.isJpa2_0Compatible() ?
- this.buildStrategy2_0() :
- this.joinColumnStrategy;
- }
-
- /**
- * The overridden mapping determines the override's strategy.
- */
- protected OrmRelationshipStrategy buildStrategy2_0() {
- MappingRelationshipStrategy2_0 mappingStrategy = this.getMappingStrategy();
- return (mappingStrategy != null) ?
- (OrmRelationshipStrategy) mappingStrategy.selectOverrideStrategy(this) :
- this.buildMissingMappingStrategy();
- }
-
- /**
- * Get the strategy from the overridden mapping.
- */
- protected MappingRelationshipStrategy2_0 getMappingStrategy() {
- RelationshipMapping mapping = this.getMapping();
- return (mapping == null) ? null : (MappingRelationshipStrategy2_0) mapping.getRelationship().getStrategy();
- }
-
- /**
- * Return the strategy to use when the override's name does not match the
- * name of an appropriate relationship mapping.
- */
- protected OrmRelationshipStrategy buildMissingMappingStrategy() {
- return this.joinColumnStrategy.hasSpecifiedJoinColumns() ?
- this.joinColumnStrategy :
- this.joinTableStrategy;
- }
-
-
- // ********** 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() {
- // association overrides do not have defaults
- 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() {
- // association overrides do not have defaults
- 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();
- }
-
- protected OrmAssociationOverride getAssociationOverride() {
- return this.getParent();
- }
-
- protected OrmAssociationOverride2_0 getAssociationOverride2_0() {
- return (OrmAssociationOverride2_0) this.getAssociationOverride();
- }
-
- public XmlAssociationOverride getXmlContainer() {
- return this.getAssociationOverride().getXmlOverride();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getAssociationOverride().getTypeMapping();
- }
-
- public String getAttributeName() {
- return this.getAssociationOverride().getName();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getAssociationOverride().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getAssociationOverride().getCandidateTableNames();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getAssociationOverride().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getAssociationOverride().getDefaultTableName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyBaseColumn column, Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride().buildColumnValidator(column, owner, textRangeResolver);
- }
-
- 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.strategy.validate(messages, reporter);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableValidator(table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java
deleted file mode 100644
index 3b24185b6b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java
+++ /dev/null
@@ -1,37 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>persistence-unit-defaults</code> element
- */
-public class GenericOrmPersistenceUnitDefaults
- extends AbstractOrmPersistenceUnitDefaults
-{
-
-
- // ********** constructor/initialization **********
-
- public GenericOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) {
- super(parent);
- }
-
- @Override
- protected XmlPersistenceUnitDefaults buildXmlPersistenceUnitDefaults() {
- return OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java
deleted file mode 100644
index 4a4b5d79c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java
+++ /dev/null
@@ -1,38 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-/**
- * <code>orm.xml</code> file
- * <br>
- * <code>persistence-unit-metadata</code> element
- */
-public class GenericOrmPersistenceUnitMetadata
- extends AbstractOrmPersistenceUnitMetadata
-{
-
- public GenericOrmPersistenceUnitMetadata(EntityMappings parent) {
- super(parent);
- }
-
- @Override
- protected XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata_() {
- return EmfTools.create(
- this.getResourceNodeFactory(),
- OrmPackage.eINSTANCE.getXmlPersistenceUnitMetadata(),
- XmlPersistenceUnitMetadata.class
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
deleted file mode 100644
index 83ce2991a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> persistent attribute
- */
-public class GenericOrmPersistentAttribute
- extends SpecifiedOrmPersistentAttribute
-{
- public GenericOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) {
- super(parent, xmlMapping);
- }
-
-
- // ********** 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 this.getJavaPersistentAttribute().getAccessor().buildAttributeValidator(this, buildTextRangeResolver());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
deleted file mode 100644
index 4bea56ba53..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java
+++ /dev/null
@@ -1,1382 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-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.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.BodySourceWriter;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentType2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> persistent type:<ul>
- * <li>mapping
- * <li>access
- * <li>attributes
- * <li>super persistent type
- * <li>Java persistent type
- * </ul>
- */
-public class GenericOrmPersistentType
- extends AbstractOrmXmlContextNode
- implements OrmPersistentType2_0
-{
- protected OrmTypeMapping mapping; // never null
-
- protected JavaPersistentType javaPersistentType;
-
- protected AccessType specifiedAccess;
- protected AccessType defaultAccess; // never null
-
- protected final Vector<OrmPersistentAttribute> specifiedAttributes = new Vector<OrmPersistentAttribute>();
- protected final SpecifiedAttributeContainerAdapter specifiedAttributeContainerAdapter = new SpecifiedAttributeContainerAdapter();
-
- protected final Vector<OrmReadOnlyPersistentAttribute> virtualAttributes = new Vector<OrmReadOnlyPersistentAttribute>();
-
- protected 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.javaPersistentType != null) ?
- this.javaPersistentType.getName() :
- 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() {
- JavaResourceAbstractType resourceType = this.resolveJavaResourceType();
- 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.getJavaResourceType() == resourceType) {
- this.javaPersistentType.update();
- } else {
- this.javaPersistentType.dispose();
- this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
- }
- }
- }
- }
-
- /**
- * Don't use getName() to resolve the java resource type.
- * getName() uses the JavaPersistentType for determining the name.
- * Changed this to fix bug 339560
- * @see #updateJavaPersistentType()
- */
- protected JavaResourceAbstractType resolveJavaResourceType() {
- return this.getEntityMappings().resolveJavaResourceType(
- this.convertMappingClassName(this.mapping.getClass_()));
- }
-
- /**
- * Return null it's an enum; don't build a JavaPersistentType
- */
- protected JavaPersistentType buildJavaPersistentType(JavaResourceAbstractType jrat) {
- return jrat.getKind() == Kind.TYPE ? this.buildJavaPersistentType((JavaResourceType) jrat) : null;
- }
-
- protected JavaPersistentType buildJavaPersistentType(JavaResourceType 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 **********
-
- @SuppressWarnings("unchecked")
- public ListIterable<OrmReadOnlyPersistentAttribute> getAttributes() {
- return new CompositeListIterable<OrmReadOnlyPersistentAttribute>(this.getReadOnlySpecifiedAttributes(), this.getVirtualAttributes());
- }
-
- public int getAttributesSize() {
- return this.getSpecifiedAttributesSize() + this.getVirtualAttributesSize();
- }
-
- 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 Iterable<ReadOnlyPersistentAttribute> getAllAttributes() {
- return new CompositeIterable<ReadOnlyPersistentAttribute>(
- new TransformationIterable<PersistentType, Iterable<ReadOnlyPersistentAttribute>>(this.getInheritanceHierarchy()) {
- @Override
- protected Iterable<ReadOnlyPersistentAttribute> transform(PersistentType pt) {
- return new SuperListIterableWrapper<ReadOnlyPersistentAttribute>(pt.getAttributes());
- }
- }
- );
- }
-
- 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)
- if (specifiedAttribute.getJavaResourceAttribute() != null) {
- if (specifiedAttribute.getJavaResourceAttribute().getKind() == Kind.FIELD) {
- JavaResourceField javaResourceField = (JavaResourceField) specifiedAttribute.getJavaResourceAttribute();
- if (this.javaResourceFieldWillBeVirtual(javaResourceField, specifiedAttribute)) {
- virtualAttribute = this.buildVirtualAttribute(javaResourceField);
- this.virtualAttributes.add(virtualIndex, virtualAttribute);
- }
- }
- else {
- PropertyAccessor propertyAccessor = (PropertyAccessor) specifiedAttribute.getJavaPersistentAttribute().getAccessor();
- JavaResourceMethod resourceGetter = propertyAccessor.getResourceGetter();
- JavaResourceMethod resourceSetter = propertyAccessor.getResourceSetter();
-
- if (this.javaResourcePropertyWillBeVirtual(resourceGetter, resourceSetter, specifiedAttribute)) {
- virtualAttribute = this.buildVirtualAttribute(resourceGetter, resourceSetter);
- 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 javaResourceFieldWillBeVirtual(JavaResourceField javaResourceField, OrmPersistentAttribute specifiedAttributeToBeRemoved) {
- return CollectionTools.contains(this.getJavaResourceFields(), javaResourceField) &&
- (this.getSpecifiedAttributeFor(javaResourceField, specifiedAttributeToBeRemoved) == null);
- }
-
- /**
- * 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 javaResourcePropertyWillBeVirtual(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter, OrmPersistentAttribute specifiedAttributeToBeRemoved) {
- return CollectionTools.contains(this.getJavaResourceMethods(), javaResourceGetter) &&
- CollectionTools.contains(this.getJavaResourceMethods(), javaResourceSetter) &&
- (this.getSpecifiedAttributeFor(javaResourceGetter, javaResourceSetter, 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 ListIterable<OrmPersistentAttribute> getSpecifiedAttributes() {
- return new LiveCloneListIterable<OrmPersistentAttribute>(this.specifiedAttributes);
- }
-
- protected ListIterable<OrmReadOnlyPersistentAttribute> getReadOnlySpecifiedAttributes() {
- return new SuperListIterableWrapper<OrmReadOnlyPersistentAttribute>(this.getSpecifiedAttributes());
- }
-
- public int getSpecifiedAttributesSize() {
- 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 ListIterable<OrmReadOnlyPersistentAttribute> getVirtualAttributes() {
- return new LiveCloneListIterable<OrmReadOnlyPersistentAttribute>(this.virtualAttributes);
- }
-
- public int getVirtualAttributesSize() {
- return this.virtualAttributes.size();
- }
-
- /**
- * 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 updateVirtualAttributes() {
- if (getVirtualJavaAccess() == AccessType.FIELD) {
- this.syncFieldAccessVirtualAttributes();
- }
- else if (getVirtualJavaAccess() == AccessType.PROPERTY) {
- this.syncPropertyAccessVirtualAttributes();
- }
- }
-
- /**
- * Initialize the attributes for AccessType.FIELD
- * 1. all non-transient, non-static fields
- * 2. all annotated methods(getters/setters)
- */
- private void syncFieldAccessVirtualAttributes() {
- HashSet<OrmReadOnlyPersistentAttribute> contextAttributes = CollectionTools.set(this.getVirtualAttributes());
-
- this.syncFieldVirtualAttributes(contextAttributes, buildNonTransientNonStaticResourceFieldsFilter());
- if (!getMapping().isMetadataComplete()) {
- this.syncAnnotatedPropertyVirtualAttributes(contextAttributes);
- }
-
- // remove any leftover context attributes
- for (OrmReadOnlyPersistentAttribute contextAttribute : contextAttributes) {
- this.removeVirtualAttribute(contextAttribute);
- }
- }
-
- /**
- * Initialize the attributes for XmlAccessType.PROPERTY
- * 1. all getter/setter javabeans pairs
- * 2. all annotated fields
- * 3. all annotated methods getters/setters that don't have a matching pair
- */
- private void syncPropertyAccessVirtualAttributes() {
- HashSet<OrmReadOnlyPersistentAttribute> contextAttributes = CollectionTools.set(this.getVirtualAttributes());
-
- if (!getMapping().isMetadataComplete()) {
- this.syncFieldVirtualAttributes(contextAttributes, AbstractJavaPersistentType.ANNOTATED_RESOURCE_FIELDS_FILTER);
- }
-
- Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getJavaResourceMethods());
- //iterate through all resource methods searching for persistable getters
- for (JavaResourceMethod getterMethod : this.getJavaResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) {
- JavaResourceMethod setterMethod = AbstractJavaPersistentType.getValidSiblingSetMethod(getterMethod, resourceMethods);
- if (javaResourcePropertyIsVirtual(getterMethod, setterMethod)) {
- if (AbstractJavaPersistentType.methodsArePersistableProperties(getterMethod, setterMethod)) {
- boolean match = false;
- for (Iterator<OrmReadOnlyPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
- OrmReadOnlyPersistentAttribute contextAttribute = stream.next();
- if (contextAttribute.isFor(getterMethod, setterMethod)) {
- match = true;
- contextAttribute.update();
- stream.remove();
- break;
- }
- }
- if (!match) {
- this.addVirtualAttribute(getVirtualAttributesSize(), this.buildVirtualAttribute(getterMethod, setterMethod));
- }
- }
- }
- resourceMethods.remove(getterMethod);
- resourceMethods.remove(setterMethod);
- }
- this.syncRemainingResourceVirtualMethods(contextAttributes, resourceMethods);
-
- // remove any leftover context attributes
- for (OrmReadOnlyPersistentAttribute contextAttribute : contextAttributes) {
- this.removeVirtualAttribute(contextAttribute);
- }
- }
-
- private void syncAnnotatedPropertyVirtualAttributes(HashSet<OrmReadOnlyPersistentAttribute> contextAttributes) {
- Collection<JavaResourceMethod> resourceMethods = CollectionTools.collection(this.getJavaResourceMethods());
- //iterate through all resource methods searching for persistable getters
- for (JavaResourceMethod getterMethod : this.getJavaResourceMethods(buildPersistablePropertyGetterMethodsFilter())) {
- JavaResourceMethod setterMethod = AbstractJavaPersistentType.getValidSiblingSetMethod(getterMethod, resourceMethods);
- if (javaResourcePropertyIsVirtual(getterMethod, setterMethod)) {
- if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) {
- boolean match = false;
- for (Iterator<OrmReadOnlyPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
- OrmReadOnlyPersistentAttribute contextAttribute = stream.next();
- if (contextAttribute.isFor(getterMethod, setterMethod)) {
- match = true;
- contextAttribute.update();
- stream.remove();
- break;
- }
- }
- if (!match) {
- this.addVirtualAttribute(getVirtualAttributesSize(), this.buildVirtualAttribute(getterMethod, setterMethod));
- }
- }
- }
- resourceMethods.remove(getterMethod);
- resourceMethods.remove(setterMethod);
- }
- this.syncRemainingResourceVirtualMethods(contextAttributes, resourceMethods);
- }
-
- private void syncFieldVirtualAttributes(HashSet<OrmReadOnlyPersistentAttribute> contextAttributes, Filter<JavaResourceField> filter) {
- for (JavaResourceField resourceField : this.getVirtualJavaResourceFields(filter)) {
- boolean match = false;
- for (Iterator<OrmReadOnlyPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext(); ) {
- OrmReadOnlyPersistentAttribute contextAttribute = stream.next();
- if (contextAttribute.isFor(resourceField)) {
- match = true;
- contextAttribute.update();
- stream.remove();
- 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)
- this.addVirtualAttribute(this.getVirtualAttributesSize(), this.buildVirtualAttribute(resourceField));
- }
- }
- }
-
- private void syncRemainingResourceVirtualMethods(HashSet<OrmReadOnlyPersistentAttribute> contextAttributes, Collection<JavaResourceMethod> resourceMethods) {
- //iterate through remaining resource methods and search for those that are annotated.
- //all getter methods will already be used.
- for (JavaResourceMethod resourceMethod : resourceMethods) {
- if (resourceMethod.isAnnotated()) {
- boolean match = false;
- //annotated setter(or other random method) with no corresponding getter, bring into context model for validation purposes
- for (Iterator<OrmReadOnlyPersistentAttribute> stream = contextAttributes.iterator(); stream.hasNext();) {
- OrmReadOnlyPersistentAttribute contextAttribute = stream.next();
- if (contextAttribute.isFor(null, resourceMethod)) {
- match = true;
- contextAttribute.update();
- stream.remove();
- break;
- }
- }
- if (!match) {
- this.addVirtualAttribute(getVirtualAttributesSize(), this.buildVirtualAttribute(null, resourceMethod));
- }
- }
- }
- }
-
- /**
- * Return all the Java resource fields that do not have a
- * corresponding <code>orm.xml</code> mapping currently
- * specified in the <code>orm.xml</code> persistent type.
- */
- protected Iterable<JavaResourceField> getVirtualJavaResourceFields() {
- return new FilteringIterable<JavaResourceField>(this.getJavaResourceFields()) {
- @Override
- protected boolean accept(JavaResourceField javaResourceField) {
- return GenericOrmPersistentType.this.javaResourceFieldIsVirtual(javaResourceField);
- }
- };
- }
-
- protected Iterable<JavaResourceField> getJavaResourceFields() {
- JavaResourceType javaResourceType = this.getJavaResourceType();
- if (javaResourceType == null) {
- return EmptyListIterable.instance();
- }
- return javaResourceType.getFields();
- }
-
- protected Iterable<JavaResourceField> getVirtualJavaResourceFields(Filter<JavaResourceField> filter) {
- return new FilteringIterable<JavaResourceField>(getVirtualJavaResourceFields(), filter);
- }
-
- protected Iterable<JavaResourceMethod> getJavaResourceMethods(Filter<JavaResourceMethod> filter) {
- return new FilteringIterable<JavaResourceMethod>(getJavaResourceMethods(), filter);
- }
-
- protected Iterable<JavaResourceMethod> getJavaResourceMethods() {
- JavaResourceType javaResourceType = this.getJavaResourceType();
- if (javaResourceType == null) {
- return EmptyListIterable.instance();
- }
- return javaResourceType.getMethods();
- }
-
- public static Filter<JavaResourceField> buildNonTransientNonStaticResourceFieldsFilter() {
- return AbstractJavaPersistentType.buildNonTransientNonStaticResourceFieldsFilter();
- }
-
- protected Filter<JavaResourceMethod> buildPersistablePropertyGetterMethodsFilter() {
- return new Filter<JavaResourceMethod>() {
- public boolean accept(JavaResourceMethod resourceMethod) {
- return AbstractJavaPersistentType.methodIsPersistablePropertyGetter(resourceMethod, getJavaResourceMethods());
- }
- };
- }
-
- protected JavaResourceType getJavaResourceType() {
- return (this.javaPersistentType == null) ? null : this.javaPersistentType.getJavaResourceType();
- }
-
- /**
- * 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 == null ? null : this.javaPersistentType.getSpecifiedAccess();
- return (javaAccess != null) ? javaAccess : this.defaultAccess;
- }
-
- protected boolean javaResourceFieldIsVirtual(JavaResourceField javaResourceField) {
- return this.getSpecifiedAttributeFor(javaResourceField) == null;
- }
-
- protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourceField javaResourceField) {
- return this.getSpecifiedAttributeFor(javaResourceField, null);
- }
-
- /**
- * Return the specified attribute corresponding to the specified Java
- * resource field, ignoring the specified excluded attribute (since
- * there can be more than one specified attribute per Java resource
- * attribute; albeit erroneously).
- */
- protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourceField javaResourceField, OrmPersistentAttribute exclude) {
- for (OrmPersistentAttribute ormAttribute : this.getSpecifiedAttributes()) {
- if (ormAttribute == exclude) {
- continue; // skip
- }
- if (ormAttribute.isFor(javaResourceField)) {
- return ormAttribute;
- }
- }
- return null;
- }
-
- protected boolean javaResourcePropertyIsVirtual(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
- return this.getSpecifiedAttributeFor(javaResourceGetter, javaResourceSetter) == null;
- }
-
- protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
- return this.getSpecifiedAttributeFor(javaResourceGetter, javaResourceSetter, null);
- }
-
- /**
- * Return the specified attribute corresponding to the specified Java
- * resource field, ignoring the specified excluded attribute (since
- * there can be more than one specified attribute per Java resource
- * attribute; albeit erroneously).
- */
- protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter, OrmPersistentAttribute exclude) {
- for (OrmPersistentAttribute ormAttribute : this.getSpecifiedAttributes()) {
- if (ormAttribute == exclude) {
- continue; // skip
- }
- if (ormAttribute.isFor(javaResourceGetter, javaResourceSetter)) {
- 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, OrmReadOnlyPersistentAttribute virtualAttribute) {
- this.addItemToList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
- }
-
- protected OrmReadOnlyPersistentAttribute buildVirtualAttribute(JavaResourceField javaResourceField) {
- return this.getContextNodeFactory().buildVirtualOrmPersistentField(this, javaResourceField);
- }
-
- protected OrmReadOnlyPersistentAttribute buildVirtualAttribute(JavaResourceMethod javaResourceGetter, JavaResourceMethod javaResourceSetter) {
- return this.getContextNodeFactory().buildVirtualOrmPersistentProperty(this, javaResourceGetter, javaResourceSetter);
- }
-
- protected void removeVirtualAttribute(OrmReadOnlyPersistentAttribute virtualAttribute) {
- virtualAttribute.dispose();
- this.removeItemFromList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST);
- }
-
-
- // ********** 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.getInheritanceHierarchy(), this) ? null : spt;
- }
-
- protected PersistentType buildSuperPersistentType_() {
- return (this.javaPersistentType == null) ? null : this.javaPersistentType.getSuperPersistentType();
- }
-
-
- // ********** inheritance **********
-
- public Iterable<PersistentType> getInheritanceHierarchy() {
- return this.getInheritanceHierarchyOf(this);
- }
-
- public Iterable<PersistentType> getAncestors() {
- return this.getInheritanceHierarchyOf(this.superPersistentType);
- }
-
- protected Iterable<PersistentType> getInheritanceHierarchyOf(PersistentType start) {
- // using a chain iterable to traverse up the inheritance tree
- return new ChainIterable<PersistentType>(start) {
- @Override
- protected PersistentType nextLink(PersistentType persistentType) {
- return persistentType.getSuperPersistentType();
- }
- };
- }
-
-
- // ********** declaring type name **********
-
- public String getDeclaringTypeName() {
- return this.declaringTypeName;
- }
-
- protected void setDeclaringTypeName(String name) {
- String old = this.declaringTypeName;
- this.declaringTypeName = name;
- this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, name);
- }
-
- protected String buildDeclaringTypeName() {
- return this.isJpa2_0Compatible() ? this.buildDeclaringTypeName_() : null;
- }
-
- protected String buildDeclaringTypeName_() {
- return (this.javaPersistentType == null) ?
- null : ((JavaPersistentType2_0) this.javaPersistentType).getDeclaringTypeName();
- }
-
-
- // ********** metamodel **********
-
- protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() {
- return this.isJpa2_0Compatible() ?
- this.getJpaFactory2_0().buildMetamodelSynchronizer(this) :
- null;
- }
-
- public IFile getMetamodelFile() {
- return (this.javaPersistentType == null) ? null : this.metamodelSynchronizer.getFile();
- }
-
- public void initializeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
- public boolean isManaged() {
- return true;
- }
-
- /**
- * All <code>orm.xml</code> persistent types must be able to generate a static metamodel
- * because 1.0 <code>orm.xml</code> files can be referenced from 2.0 persistence.xml files.
- */
- public void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- if (this.javaPersistentType != null) {
- this.metamodelSynchronizer.synchronize(memberTypeTree);
- }
- }
-
- public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- if (this.javaPersistentType != null) {
- this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree);
- }
- }
-
- public void disposeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return OrmStructureNodes.PERSISTENT_TYPE_ID;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (OrmPersistentAttribute attribute : this.getSpecifiedAttributes()) {
- if (attribute.contains(textOffset)) {
- return attribute;
- }
- }
- return this;
- }
-
- public TextRange getSelectionTextRange() {
- return this.mapping.getSelectionTextRange();
- }
-
- public void dispose() {
- if (this.javaPersistentType != null) {
- this.javaPersistentType.dispose();
- }
- for (OrmReadOnlyPersistentAttribute virtualAttribute : this.getVirtualAttributes()) {
- virtualAttribute.dispose();
- }
- }
-
-
- // ********** PersistentType.Owner implementation **********
-
- public AccessType getOverridePersistentTypeAccess() {
- if (this.specifiedAccess != null) {
- return this.specifiedAccess;
- }
-
- if (this.superPersistentType instanceof OrmPersistentType) {
- AccessType accessType = ((OrmPersistentType) this.superPersistentType).getSpecifiedAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- if (this.mapping.isMetadataComplete()) {
- AccessType accessType = this.getOwnerDefaultAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- // no override access type
- return null;
- }
-
- public AccessType getDefaultPersistentTypeAccess() {
- if (this.superPersistentType instanceof OrmPersistentType) {
- AccessType accessType = ((OrmPersistentType) this.superPersistentType).getDefaultAccess();
- if (accessType != null) {
- return accessType;
- }
- }
-
- return this.getOwnerDefaultAccess();
- }
-
-
- //*********** refactoring ***********
-
- public Iterable<DeleteEdit> createDeleteTypeEdits(IType type) {
- return this.isFor(type.getFullyQualifiedName('.')) ?
- new SingleElementIterable<DeleteEdit>(this.mapping.createDeleteEdit()) :
- EmptyIterable.<DeleteEdit>instance();
- }
-
- @SuppressWarnings("unchecked")
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return new CompositeIterable<ReplaceEdit>(
- this.mapping.createRenameTypeEdits(originalType, newName),
- this.createSpecifiedAttributesRenameTypeEdits(originalType, newName)
- );
- }
-
- protected Iterable<ReplaceEdit> createSpecifiedAttributesRenameTypeEdits(final IType originalType, final String newName) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
- return persistentAttribute.createRenameTypeEdits(originalType, newName);
- }
- }
- );
- }
-
- @SuppressWarnings("unchecked")
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return new CompositeIterable<ReplaceEdit>(
- this.mapping.createMoveTypeEdits(originalType, newPackage),
- this.createSpecifiedAttributesMoveTypeEdits(originalType, newPackage)
- );
- }
-
- protected Iterable<ReplaceEdit> createSpecifiedAttributesMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
- return persistentAttribute.createMoveTypeEdits(originalType, newPackage);
- }
- }
- );
- }
-
- @SuppressWarnings("unchecked")
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return new CompositeIterable<ReplaceEdit>(
- this.mapping.createRenamePackageEdits(originalPackage, newName),
- this.createSpecifiedAttributesRenamePackageEdits(originalPackage, newName)
- );
- }
-
- protected Iterable<ReplaceEdit> createSpecifiedAttributesRenamePackageEdits(final IPackageFragment originalPackage, final String newName) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<OrmPersistentAttribute, Iterable<ReplaceEdit>>(this.getSpecifiedAttributes()) {
- @Override
- protected Iterable<ReplaceEdit> transform(OrmPersistentAttribute persistentAttribute) {
- return persistentAttribute.createRenamePackageEdits(originalPackage, newName);
- }
- }
- );
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateClass(messages);
- this.validateMapping(messages, reporter);
- this.validateAttributes(messages, reporter);
- }
-
- protected void validateClass(List<IMessage> messages) {
- if (this.javaPersistentType == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_TYPE_UNRESOLVED_CLASS,
- new String[] {this.getName()},
- this,
- this.mapping.getClassTextRange()
- )
- );
- }
- }
-
- protected void validateMapping(List<IMessage> messages, IReporter reporter) {
- try {
- this.mapping.validate(messages, reporter);
- } catch(Throwable t) {
- JptJpaCorePlugin.log(t);
- }
- }
-
- protected void validateAttributes(List<IMessage> messages, IReporter reporter) {
- for (OrmReadOnlyPersistentAttribute attribute : this.getAttributes()) {
- this.validateAttribute(attribute, messages, reporter);
- }
- }
-
- protected void validateAttribute(OrmReadOnlyPersistentAttribute attribute, List<IMessage> messages, IReporter reporter) {
- try {
- attribute.validate(messages, reporter);
- } catch(Throwable t) {
- JptJpaCorePlugin.log(t);
- }
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.mapping.getValidationTextRange();
- return (textRange != null) ? textRange : this.getEntityMappings().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public EntityMappings getParent() {
- return (EntityMappings) super.getParent();
- }
-
- protected EntityMappings getEntityMappings() {
- return this.getParent();
- }
-
- public String getDefaultPackage() {
- return this.getEntityMappings().getPackage();
- }
-
- public boolean isFor(String typeName) {
- String name = this.getName();
- if (name == null) {
- return false;
- }
- if (name.equals(typeName)) {
- return true;
- }
- String defaultPackage = this.getDefaultPackage();
- if (defaultPackage == null) {
- return false;
- }
- return (defaultPackage + '.' + name).equals(typeName);
- }
-
- public boolean isIn(IPackageFragment packageFragment) {
- String packageName = this.getPackageName();
- if (Tools.valuesAreEqual(packageName, packageFragment.getElementName())) {
- return true;
- }
- String defaultPackage = this.getDefaultPackage();
- if (defaultPackage == null) {
- return false;
- }
- packageName = (packageName == null) ? defaultPackage : defaultPackage + '.' + packageName;
- return packageName.equals(packageFragment.getElementName());
- }
-
- protected String getPackageName() {
- String className = this.getName();
- if (className == null) {
- return null;
- }
- int lastPeriod = className.lastIndexOf('.');
- return (lastPeriod == -1) ? null : className.substring(0, lastPeriod);
- }
-
- public boolean contains(int textOffset) {
- return this.mapping.containsOffset(textOffset);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.getName());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
deleted file mode 100644
index 86757a9428..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,176 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmPrimaryKeyJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * <code>orm.xml</code> primary key join column
- */
-public class GenericOrmPrimaryKeyJoinColumn
- extends AbstractOrmNamedColumn<XmlPrimaryKeyJoinColumn, OrmReadOnlyBaseJoinColumn.Owner>
- implements OrmPrimaryKeyJoinColumn
-{
- /** @see org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn) */
- protected /* final */ XmlPrimaryKeyJoinColumn xmlColumn; // null for default pk join columns
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmReadOnlyBaseJoinColumn.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();
- }
-
-
- // ********** validation **********
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver() {
- return new OrmPrimaryKeyJoinColumnTextRangeResolver(this);
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.getValidationTextRange(this.xmlColumn.getReferencedColumnNameTextRange());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
deleted file mode 100644
index cc577649ac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java
+++ /dev/null
@@ -1,253 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> query container
- */
-public class GenericOrmQueryContainer
- extends AbstractOrmXmlContextNode
- implements OrmQueryContainer
-{
- protected final XmlQueryContainer xmlQueryContainer;
-
- protected final ContextListContainer<OrmNamedQuery, XmlNamedQuery> namedQueryContainer;
- protected final ContextListContainer<OrmNamedNativeQuery, XmlNamedNativeQuery> namedNativeQueryContainer;
-
-
- public GenericOrmQueryContainer(XmlContextNode parent, XmlQueryContainer xmlQueryContainer) {
- super(parent);
- this.xmlQueryContainer = xmlQueryContainer;
- this.namedQueryContainer = this.buildNamedQueryContainer();
- this.namedNativeQueryContainer = this.buildNamedNativeQueryContainer();
- }
-
-
- // ********** 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 ListIterable<OrmNamedQuery> getNamedQueries() {
- return this.namedQueryContainer.getContextElements();
- }
-
- public int getNamedQueriesSize() {
- return this.namedQueryContainer.getContextElementsSize();
- }
-
- public OrmNamedQuery addNamedQuery() {
- return this.addNamedQuery(this.getNamedQueriesSize());
- }
-
- public OrmNamedQuery addNamedQuery(int index) {
- XmlNamedQuery xmlQuery = this.buildXmlNamedQuery();
- OrmNamedQuery query = this.namedQueryContainer.addContextElement(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.namedQueryContainer.indexOfContextElement((OrmNamedQuery) namedQuery));
- }
-
- public void removeNamedQuery(int index) {
- this.namedQueryContainer.removeContextElement(index);
- this.xmlQueryContainer.getNamedQueries().remove(index);
- }
-
- public void moveNamedQuery(int targetIndex, int sourceIndex) {
- this.namedQueryContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlQueryContainer.getNamedQueries().move(targetIndex, sourceIndex);
- }
-
- protected OrmNamedQuery buildNamedQuery(XmlNamedQuery xmlNamedQuery) {
- return this.getContextNodeFactory().buildOrmNamedQuery(this, xmlNamedQuery);
- }
-
- protected void syncNamedQueries() {
- this.namedQueryContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlNamedQuery> getXmlNamedQueries() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlNamedQuery>(this.xmlQueryContainer.getNamedQueries());
- }
-
- protected ContextListContainer<OrmNamedQuery, XmlNamedQuery> buildNamedQueryContainer() {
- return new NamedQueryContainer();
- }
-
- /**
- * named query container
- */
- protected class NamedQueryContainer
- extends ContextListContainer<OrmNamedQuery, XmlNamedQuery>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return NAMED_QUERIES_LIST;
- }
- @Override
- protected OrmNamedQuery buildContextElement(XmlNamedQuery resourceElement) {
- return GenericOrmQueryContainer.this.buildNamedQuery(resourceElement);
- }
- @Override
- protected ListIterable<XmlNamedQuery> getResourceElements() {
- return GenericOrmQueryContainer.this.getXmlNamedQueries();
- }
- @Override
- protected XmlNamedQuery getResourceElement(OrmNamedQuery contextElement) {
- return contextElement.getXmlQuery();
- }
- }
-
- // ********** named native queries **********
-
- public ListIterable<OrmNamedNativeQuery> getNamedNativeQueries() {
- return this.namedNativeQueryContainer.getContextElements();
- }
-
- public int getNamedNativeQueriesSize() {
- return this.namedNativeQueryContainer.getContextElementsSize();
- }
-
- public OrmNamedNativeQuery addNamedNativeQuery() {
- return this.addNamedNativeQuery(this.getNamedNativeQueriesSize());
- }
-
- public OrmNamedNativeQuery addNamedNativeQuery(int index) {
- XmlNamedNativeQuery xmlQuery = this.buildXmlNamedNativeQuery();
- OrmNamedNativeQuery query = this.namedNativeQueryContainer.addContextElement(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.namedNativeQueryContainer.indexOfContextElement((OrmNamedNativeQuery) namedNativeQuery));
- }
-
- public void removeNamedNativeQuery(int index) {
- this.namedNativeQueryContainer.removeContextElement(index);
- this.xmlQueryContainer.getNamedNativeQueries().remove(index);
- }
-
- public void moveNamedNativeQuery(int targetIndex, int sourceIndex) {
- this.namedNativeQueryContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlQueryContainer.getNamedNativeQueries().move(targetIndex, sourceIndex);
- }
-
- protected OrmNamedNativeQuery buildNamedNativeQuery(XmlNamedNativeQuery xmlNamedNativeQuery) {
- return this.getContextNodeFactory().buildOrmNamedNativeQuery(this, xmlNamedNativeQuery);
- }
-
- protected void syncNamedNativeQueries() {
- this.namedNativeQueryContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlNamedNativeQuery> getXmlNamedNativeQueries() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlNamedNativeQuery>(this.xmlQueryContainer.getNamedNativeQueries());
- }
-
- protected ContextListContainer<OrmNamedNativeQuery, XmlNamedNativeQuery> buildNamedNativeQueryContainer() {
- return new NamedNativeQueryContainer();
- }
-
- /**
- * named query container
- */
- protected class NamedNativeQueryContainer
- extends ContextListContainer<OrmNamedNativeQuery, XmlNamedNativeQuery>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return NAMED_NATIVE_QUERIES_LIST;
- }
- @Override
- protected OrmNamedNativeQuery buildContextElement(XmlNamedNativeQuery resourceElement) {
- return GenericOrmQueryContainer.this.buildNamedNativeQuery(resourceElement);
- }
- @Override
- protected ListIterable<XmlNamedNativeQuery> getResourceElements() {
- return GenericOrmQueryContainer.this.getXmlNamedNativeQueries();
- }
- @Override
- protected XmlNamedNativeQuery getResourceElement(OrmNamedNativeQuery contextElement) {
- return contextElement.getXmlQuery();
- }
- }
-
-
- // ********** validation **********
-
- /**
- * The queries are validated in the persistence unit.
- * @see org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#validateQueries(List, IReporter)
- */
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // queries are validated in the persistence unit
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlQueryContainer.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
deleted file mode 100644
index 370b277edb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java
+++ /dev/null
@@ -1,112 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint;
-
-/**
- * <code>orm.xml</code> query hint
- */
-public class GenericOrmQueryHint
- extends AbstractOrmXmlContextNode
- implements OrmQueryHint
-{
- protected final XmlQueryHint xmlQueryHint;
-
- protected String name;
- protected String value;
-
-
- public GenericOrmQueryHint(OrmQuery parent, XmlQueryHint xmlQueryHint) {
- super(parent);
- this.xmlQueryHint = xmlQueryHint;
- this.name = xmlQueryHint.getName();
- this.value = xmlQueryHint.getValue();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setName_(this.xmlQueryHint.getName());
- this.setValue_(this.xmlQueryHint.getValue());
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.setName_(name);
- this.xmlQueryHint.setName(name);
- }
-
- protected void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
-
- // ********** value **********
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- this.setValue_(value);
- this.xmlQueryHint.setValue(value);
- }
-
- protected void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlQueryHint.getValidationTextRange();
- return (textRange != null) ? textRange : this.getQuery().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmQuery getParent() {
- return (OrmQuery) super.getParent();
- }
-
- protected OrmQuery getQuery() {
- return this.getParent();
- }
-
- public XmlQueryHint getXmlQueryHint() {
- return this.xmlQueryHint;
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
deleted file mode 100644
index 500b4e751c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java
+++ /dev/null
@@ -1,262 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReferenceTable;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> join table or collection table
- */
-public abstract class GenericOrmReferenceTable<X extends AbstractXmlReferenceTable>
- extends AbstractOrmTable<X>
- implements OrmReferenceTable
-{
- protected final ContextListContainer<OrmJoinColumn, XmlJoinColumn> specifiedJoinColumnContainer;
- protected final OrmReadOnlyJoinColumn.Owner joinColumnOwner;
-
- protected OrmJoinColumn defaultJoinColumn;
-
-
- protected GenericOrmReferenceTable(XmlContextNode parent, Owner owner) {
- super(parent, owner);
- this.joinColumnOwner = this.buildJoinColumnOwner();
- this.specifiedJoinColumnContainer = this.buildSpecifiedJoinColumnContainer();
- }
-
-
- // ********** 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 ListIterable<OrmJoinColumn> getJoinColumns() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns();
- }
-
- public int getJoinColumnsSize() {
- return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize();
- }
-
- public void convertDefaultJoinColumnToSpecified() {
- MappingTools.convertReferenceTableDefaultToSpecifiedJoinColumn(this);
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
- return this.specifiedJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- return this.specifiedJoinColumnContainer.getContextElementsSize();
- }
-
- public boolean hasSpecifiedJoinColumns() {
- return this.getSpecifiedJoinColumnsSize() != 0;
- }
-
- public OrmJoinColumn getSpecifiedJoinColumn(int index) {
- return this.specifiedJoinColumnContainer.getContextElement(index);
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn() {
- return this.addSpecifiedJoinColumn(this.getSpecifiedJoinColumnsSize());
- }
-
- public OrmJoinColumn addSpecifiedJoinColumn(int index) {
- X xmlTable = this.getXmlTableForUpdate();
- XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn();
- OrmJoinColumn joinColumn = this.specifiedJoinColumnContainer.addContextElement(index, xmlJoinColumn);
- xmlTable.getJoinColumns().add(index, xmlJoinColumn);
- return joinColumn;
- }
-
- protected XmlJoinColumn buildXmlJoinColumn() {
- return OrmFactory.eINSTANCE.createXmlJoinColumn();
- }
-
- public void removeSpecifiedJoinColumn(JoinColumn joinColumn) {
- this.removeSpecifiedJoinColumn(this.specifiedJoinColumnContainer.indexOfContextElement((OrmJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedJoinColumn(int index) {
- this.specifiedJoinColumnContainer.removeContextElement(index);
- this.getXmlTable().getJoinColumns().remove(index);
- this.removeXmlTableIfUnset();
- }
-
- public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) {
- this.specifiedJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- this.getXmlTable().getJoinColumns().move(targetIndex, sourceIndex);
- }
-
- protected void syncSpecifiedJoinColumns() {
- this.specifiedJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected ListIterable<XmlJoinColumn> getXmlJoinColumns() {
- X xmlTable = this.getXmlTable();
- return (xmlTable == null) ?
- EmptyListIterable.<XmlJoinColumn>instance() :
- // clone to reduce chance of concurrency problems
- new LiveCloneListIterable<XmlJoinColumn>(xmlTable.getJoinColumns());
- }
-
- protected ContextListContainer<OrmJoinColumn, XmlJoinColumn> buildSpecifiedJoinColumnContainer() {
- return new SpecifiedJoinColumnContainer();
- }
-
- /**
- * specified join column container
- */
- protected class SpecifiedJoinColumnContainer
- extends ContextListContainer<OrmJoinColumn, XmlJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmJoinColumn buildContextElement(XmlJoinColumn resourceElement) {
- return GenericOrmReferenceTable.this.buildJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<XmlJoinColumn> getResourceElements() {
- return GenericOrmReferenceTable.this.getXmlJoinColumns();
- }
- @Override
- protected XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- }
-
- protected abstract OrmReadOnlyJoinColumn.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 : oldTable.getSpecifiedJoinColumns()) {
- this.addSpecifiedJoinColumn().initializeFrom(joinColumn);
- }
- }
-
- protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) {
- super.initializeFromVirtual(virtualTable);
- for (ReadOnlyJoinColumn joinColumn : virtualTable.getJoinColumns()) {
- 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.validateNodes(this.getJoinColumns(), messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
deleted file mode 100644
index 54c5bddabf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java
+++ /dev/null
@@ -1,375 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable;
-import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>orm.xml</code> secondary table
- */
-public class GenericOrmSecondaryTable
- extends AbstractOrmTable<XmlSecondaryTable>
- implements OrmSecondaryTable
-{
- /** @see AbstractOrmTable#AbstractOrmTable(org.eclipse.jpt.jpa.core.context.XmlContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable) */
- protected /* final */ XmlSecondaryTable xmlSecondaryTable;
-
- protected final ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> specifiedPrimaryKeyJoinColumnContainer;
- protected final OrmReadOnlyBaseJoinColumn.Owner primaryKeyJoinColumnOwner;
-
- protected OrmPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn;
-
-
- public GenericOrmSecondaryTable(OrmEntity parent, Owner owner, XmlSecondaryTable xmlSecondaryTable) {
- super(parent, owner, xmlSecondaryTable);
- this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner();
- this.specifiedPrimaryKeyJoinColumnContainer = this.buildSpecifiedPrimaryKeyJoinColumnContainer();
- }
-
-
- // ********** 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 ListIterable<OrmPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns();
- }
-
- public int getPrimaryKeyJoinColumnsSize() {
- return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize();
- }
-
-
- // ********** specified primary key join columns **********
-
- public ListIterable<OrmPrimaryKeyJoinColumn> getSpecifiedPrimaryKeyJoinColumns() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElements();
- }
-
- public int getSpecifiedPrimaryKeyJoinColumnsSize() {
- return this.specifiedPrimaryKeyJoinColumnContainer.getContextElementsSize();
- }
-
- protected boolean hasSpecifiedPrimaryKeyJoinColumns() {
- return this.getSpecifiedPrimaryKeyJoinColumnsSize() != 0;
- }
-
- public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() {
- return this.addSpecifiedPrimaryKeyJoinColumn(this.getSpecifiedPrimaryKeyJoinColumnsSize());
- }
-
- public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) {
- XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn();
- OrmPrimaryKeyJoinColumn joinColumn = this.specifiedPrimaryKeyJoinColumnContainer.addContextElement(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.specifiedPrimaryKeyJoinColumnContainer.indexOfContextElement((OrmPrimaryKeyJoinColumn) joinColumn));
- }
-
- public void removeSpecifiedPrimaryKeyJoinColumn(int index) {
- this.specifiedPrimaryKeyJoinColumnContainer.removeContextElement(index);
- this.xmlSecondaryTable.getPrimaryKeyJoinColumns().remove(index);
- }
-
- public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) {
- this.specifiedPrimaryKeyJoinColumnContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlSecondaryTable.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex);
- }
-
- protected void syncSpecifiedPrimaryKeyJoinColumns() {
- this.specifiedPrimaryKeyJoinColumnContainer.synchronizeWithResourceModel();
- }
-
- protected void updateSpecifiedPrimaryKeyJoinColumns() {
- this.specifiedPrimaryKeyJoinColumnContainer.update();
- }
-
- protected ListIterable<XmlPrimaryKeyJoinColumn> getXmlPrimaryKeyJoinColumns() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlPrimaryKeyJoinColumn>(this.xmlSecondaryTable.getPrimaryKeyJoinColumns());
- }
-
- protected ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn> buildSpecifiedPrimaryKeyJoinColumnContainer() {
- return new SpecifiedPrimaryKeyJoinColumnContainer();
- }
-
- /**
- * specified primary key join column container
- */
- protected class SpecifiedPrimaryKeyJoinColumnContainer
- extends ContextListContainer<OrmPrimaryKeyJoinColumn, XmlPrimaryKeyJoinColumn>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST;
- }
- @Override
- protected OrmPrimaryKeyJoinColumn buildContextElement(XmlPrimaryKeyJoinColumn resourceElement) {
- return GenericOrmSecondaryTable.this.buildPrimaryKeyJoinColumn(resourceElement);
- }
- @Override
- protected ListIterable<XmlPrimaryKeyJoinColumn> getResourceElements() {
- return GenericOrmSecondaryTable.this.getXmlPrimaryKeyJoinColumns();
- }
- @Override
- protected XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) {
- return contextElement.getXmlColumn();
- }
- }
-
- protected OrmReadOnlyBaseJoinColumn.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 : oldSecondaryTable.getSpecifiedPrimaryKeyJoinColumns()) {
- 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) {
- this.validateNodes(this.getPrimaryKeyJoinColumns(), messages, reporter);
- }
- }
-
-
- // ********** primary key join column owner adapter **********
-
- protected class PrimaryKeyJoinColumnOwner
- implements OrmReadOnlyBaseJoinColumn.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.getJoinColumnsSize() != 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 getJoinColumnsSize() {
- return GenericOrmSecondaryTable.this.getPrimaryKeyJoinColumnsSize();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn;
- }
-
- public Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmSecondaryTable.this.getValidationTextRange();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericOrmSecondaryTable.this, (ReadOnlyBaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java
deleted file mode 100644
index 5e56c71cc4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-
-/**
- * <code>orm.xml</code> sequence generator
- */
-public class GenericOrmSequenceGenerator
- extends AbstractOrmSequenceGenerator
-{
- public GenericOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) {
- super(parent, xmlSequenceGenerator);
- }
-
- // ********** database stuff **********
-
- /**
- * The JPA 1.0 spec does not allow a sequence to specify a catalog.
- */
- @Override
- protected String getCatalog() {
- return this.getContextDefaultCatalog();
- }
-
- /**
- * The JPA 1.0 spec does not allow a sequence to specify a schema.
- */
- @Override
- protected String getSchema() {
- return this.getContextDefaultSchema();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java
deleted file mode 100644
index 0832952ada..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmEntity;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTable;
-
-/**
- * <code>orm.xml</code> table
- */
-public class GenericOrmTable
- extends AbstractOrmTable<XmlTable>
-{
- public GenericOrmTable(OrmEntity parent, Owner owner) {
- super(parent, owner);
- }
-
-
- // ********** XML table **********
-
- @Override
- protected XmlTable getXmlTable() {
- return this.getXmlEntity().getTable();
- }
-
- @Override
- protected XmlTable buildXmlTable() {
- XmlTable xmlTable = OrmFactory.eINSTANCE.createXmlTable();
- this.getXmlEntity().setTable(xmlTable);
- return xmlTable;
- }
-
- @Override
- protected void removeXmlTable() {
- this.getXmlEntity().setTable(null);
- }
-
- protected XmlEntity getXmlEntity() {
- return this.getEntity().getXmlTypeMapping();
- }
-
-
- // ********** defaults **********
-
- @Override
- protected String buildDefaultName() {
- return this.getEntity().getDefaultTableName();
- }
-
- @Override
- protected String buildDefaultSchema() {
- return this.getEntity().getDefaultSchema();
- }
-
- @Override
- protected String buildDefaultCatalog() {
- return this.getEntity().getDefaultCatalog();
- }
-
-
- // ********** validation **********
-
- public boolean validatesAgainstDatabase() {
- return this.connectionProfileIsActive();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmEntity getParent() {
- return (OrmEntity) super.getParent();
- }
-
- protected OrmEntity getEntity() {
- return this.getParent();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
deleted file mode 100644
index 7b51aa3b13..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java
+++ /dev/null
@@ -1,414 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.UniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator;
-import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
-import org.eclipse.jpt.jpa.db.Schema;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * <code>orm.xml</code> table generator
- */
-public class GenericOrmTableGenerator
- extends AbstractOrmGenerator<XmlTableGenerator>
- implements OrmTableGenerator, UniqueConstraint.Owner
-{
- protected String specifiedTable;
- protected String defaultTable;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedPkColumnName;
- protected String defaultPkColumnName;
-
- protected String specifiedValueColumnName;
- protected String defaultValueColumnName;
-
- protected String specifiedPkColumnValue;
- protected String defaultPkColumnValue;
-
- protected final ContextListContainer<OrmUniqueConstraint, XmlUniqueConstraint> uniqueConstraintContainer;
-
-
- // ********** 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.uniqueConstraintContainer = new UniqueConstraintContainer();
- }
-
-
- // ********** 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 ListIterable<OrmUniqueConstraint> getUniqueConstraints() {
- return this.uniqueConstraintContainer.getContextElements();
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraintContainer.getContextElementsSize();
- }
-
- public OrmUniqueConstraint addUniqueConstraint() {
- return this.addUniqueConstraint(this.getUniqueConstraintsSize());
- }
-
- public OrmUniqueConstraint addUniqueConstraint(int index) {
- XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint();
- OrmUniqueConstraint constraint = this.uniqueConstraintContainer.addContextElement(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.uniqueConstraintContainer.indexOfContextElement((OrmUniqueConstraint) uniqueConstraint));
- }
-
- public void removeUniqueConstraint(int index) {
- this.uniqueConstraintContainer.removeContextElement(index);
- this.xmlGenerator.getUniqueConstraints().remove(index);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.uniqueConstraintContainer.moveContextElement(targetIndex, sourceIndex);
- this.xmlGenerator.getUniqueConstraints().move(targetIndex, sourceIndex);
- }
-
- protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint resourceUniqueConstraint) {
- return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, resourceUniqueConstraint);
- }
-
- protected void syncUniqueConstraints() {
- this.uniqueConstraintContainer.synchronizeWithResourceModel();
- }
-
- protected void updateUniqueConstraints() {
- this.uniqueConstraintContainer.update();
- }
-
- protected ListIterable<XmlUniqueConstraint> getXmlUniqueConstraints() {
- // clone to reduce chance of concurrency problems
- return new LiveCloneListIterable<XmlUniqueConstraint>(this.xmlGenerator.getUniqueConstraints());
- }
-
- /**
- * unique constraint container
- */
- protected class UniqueConstraintContainer
- extends ContextListContainer<OrmUniqueConstraint, XmlUniqueConstraint>
- {
- @Override
- protected String getContextElementsPropertyName() {
- return UNIQUE_CONSTRAINTS_LIST;
- }
- @Override
- protected OrmUniqueConstraint buildContextElement(XmlUniqueConstraint resourceElement) {
- return GenericOrmTableGenerator.this.buildUniqueConstraint(resourceElement);
- }
- @Override
- protected ListIterable<XmlUniqueConstraint> getResourceElements() {
- return GenericOrmTableGenerator.this.getXmlUniqueConstraints();
- }
- @Override
- protected XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) {
- return contextElement.getXmlUniqueConstraint();
- }
- }
-
-
- // ********** UniqueConstraint.Owner implementation **********
-
- public Iterable<String> getCandidateUniqueConstraintColumnNames() {
- org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable();
- return (dbTable != null) ? dbTable.getSortedColumnIdentifiers() : EmptyIterable.<String>instance();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
deleted file mode 100644
index 138e39344f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java
+++ /dev/null
@@ -1,151 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.TemporalConverter;
-import org.eclipse.jpt.jpa.core.context.TemporalType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.AbstractOrmElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-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 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 **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateAttributeTypeWithTemporal(messages);
- }
-
- protected void validateAttributeTypeWithTemporal(List<IMessage> messages) {
- if (this.getAttributeMapping().getKey() == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
- @SuppressWarnings("rawtypes")
- String typeName = ((AbstractOrmElementCollectionMapping2_0) this.getAttributeMapping()).getTargetClass();
- if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange()
- )
- );
- }
- } else {
- String typeName = this.getAttributeMapping().getPersistentAttribute().getTypeName();
- if (!ArrayTools.contains(TEMPORAL_MAPPING_SUPPORTED_TYPES, typeName)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange()
- )
- );
- }
-
- }
- }
-
- @Override
- protected TextRange getXmlValidationTextRange() {
- return this.getXmlConvertibleMapping().getTemporalTextRange();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java
deleted file mode 100644
index fdd0cbbe07..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient;
-
-/**
- * <code>orm.xml</code> transient mapping
- */
-public class GenericOrmTransientMapping
- extends AbstractOrmAttributeMapping<XmlTransient>
- implements OrmTransientMapping
-{
- public GenericOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient xmlMapping) {
- super(parent, xmlMapping);
- }
-
- public String getKey() {
- return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY;
- }
-
- public int getXmlSequence() {
- return 90;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmTransientMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes resourceAttributes) {
- resourceAttributes.getTransients().add(this.xmlAttributeMapping);
- }
-
- public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) {
- resourceAttributes.getTransients().remove(this.xmlAttributeMapping);
- }
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
deleted file mode 100644
index 37ff432641..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java
+++ /dev/null
@@ -1,105 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint;
-
-public class GenericOrmUniqueConstraint
- extends AbstractOrmReadOnlyUniqueConstraint
- implements OrmUniqueConstraint
-{
- protected Owner owner;
- protected final XmlUniqueConstraint xmlUniqueConstraint;
-
-
- public GenericOrmUniqueConstraint(XmlContextNode parent, Owner owner, XmlUniqueConstraint xmlUniqueConstraint) {
- super(parent);
- this.owner = owner;
- this.xmlUniqueConstraint = xmlUniqueConstraint;
- this.initializeColumnNames();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncColumnNames();
- }
-
-
- // ********** column names **********
-
- public void addColumnName(String columnName) {
- this.addColumnName(this.columnNames.size(), columnName);
- }
-
- public void addColumnName(int index, String columnName) {
- this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST);
- this.xmlUniqueConstraint.getColumnNames().add(index, columnName);
- }
-
- public void removeColumnName(String columnName) {
- this.removeColumnName(this.columnNames.indexOf(columnName));
- }
-
- public void removeColumnName(int index) {
- this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST);
- this.xmlUniqueConstraint.getColumnNames().remove(index);
- }
-
- public void moveColumnName(int targetIndex, int sourceIndex) {
- this.moveItemInList(targetIndex, sourceIndex, this.columnNames, COLUMN_NAMES_LIST);
- this.xmlUniqueConstraint.getColumnNames().move(targetIndex, sourceIndex);
- }
-
- protected void initializeColumnNames() {
- for (String xmlColumnName : this.xmlUniqueConstraint.getColumnNames()) {
- this.columnNames.add(xmlColumnName);
- }
- }
-
- @Override
- protected Iterable<String> getResourceColumnNames() {
- return this.xmlUniqueConstraint.getColumnNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlUniqueConstraint.getValidationTextRange();
- return (textRange != null) ? textRange : this.getParent().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public XmlUniqueConstraint getXmlUniqueConstraint() {
- return this.xmlUniqueConstraint;
- }
-
- public void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint) {
- for (String columnName : oldUniqueConstraint.getColumnNames()) {
- this.addColumnName(columnName);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java
deleted file mode 100644
index 5cd6602686..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVersionMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion;
-
-
-public class GenericOrmVersionMapping
- extends AbstractOrmVersionMapping<XmlVersion>
-{
- public GenericOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion xmlMapping) {
- super(parent, xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java
deleted file mode 100644
index 4618e9f0cc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java
+++ /dev/null
@@ -1,101 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmVirtualAssociationOverride2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * Virtual <code>orm.xml</code> association override
- */
-public class GenericOrmVirtualAssociationOverride
- extends AbstractOrmVirtualOverride<OrmAssociationOverrideContainer>
- implements OrmVirtualAssociationOverride2_0
-{
- 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);
- }
-
- protected OrmAssociationOverrideContainer2_0 getContainer2_0() {
- return (OrmAssociationOverrideContainer2_0) this.getContainer();
- }
-
-
- // ********** 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 ReadOnlyRelationship resolveOverriddenRelationship() {
- return this.getContainer().resolveOverriddenRelationship(this.name);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.relationship.validate(messages, reporter);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableValidator(this, table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableJoinColumnValidator(this, column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getContainer2_0().buildJoinTableInverseJoinColumnValidator(this, column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java
deleted file mode 100644
index 13db6f54de..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java
+++ /dev/null
@@ -1,108 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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 **********
-
- @Override
- public String getDefaultTableName() {
- String overriddenColumnTable = this.getOverriddenColumnTable();
- return (overriddenColumnTable != null) ? overriddenColumnTable : super.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 ReadOnlyColumn resolveOverriddenColumn() {
- return this.getContainer().resolveOverriddenColumn(this.name);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn col, NamedColumnTextRangeResolver textRangeResolver) {
- return this.getContainer().buildColumnValidator(this, (ReadOnlyBaseColumn) col, this, (BaseColumnTextRangeResolver) textRangeResolver);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.column.validate(messages, reporter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java
deleted file mode 100644
index 8797fb7aa9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java
+++ /dev/null
@@ -1,167 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualBaseColumn;
-
-/**
- * <code>orm.xml</code> virtual column
- */
-public class GenericOrmVirtualColumn
- extends AbstractOrmVirtualBaseColumn<OrmVirtualColumn.Owner, ReadOnlyColumn>
- implements OrmVirtualColumn
-{
- protected Integer specifiedLength;
- protected int defaultLength;
-
- protected Integer specifiedPrecision;
- protected int defaultPrecision;
-
- protected Integer specifiedScale;
- protected int defaultScale;
-
-
- public GenericOrmVirtualColumn(XmlContextNode 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 ReadOnlyColumn getOverriddenColumn() {
- return this.owner.resolveOverriddenColumn();
- }
-
-
- // ********** length **********
-
- public int getLength() {
- return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength;
- }
-
- public Integer getSpecifiedLength() {
- return this.specifiedLength;
- }
-
- protected void setSpecifiedLength(Integer length) {
- Integer old = this.specifiedLength;
- this.specifiedLength = length;
- this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length);
- }
-
- protected Integer buildSpecifiedLength() {
- return this.getOverriddenColumn().getSpecifiedLength();
- }
-
- public int getDefaultLength() {
- return this.defaultLength;
- }
-
- protected void setDefaultLength(int length) {
- int old = this.defaultLength;
- this.defaultLength = length;
- this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length);
- }
-
- protected int buildDefaultLength() {
- return DEFAULT_LENGTH;
- }
-
-
- // ********** precision **********
-
- public int getPrecision() {
- return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision;
- }
-
- public Integer getSpecifiedPrecision() {
- return this.specifiedPrecision;
- }
-
- protected void setSpecifiedPrecision(Integer precision) {
- Integer old = this.specifiedPrecision;
- this.specifiedPrecision = precision;
- this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision);
- }
-
- protected Integer buildSpecifiedPrecision() {
- return this.getOverriddenColumn().getSpecifiedPrecision();
- }
-
- public int getDefaultPrecision() {
- return this.defaultPrecision;
- }
-
- protected void setDefaultPrecision(int precision) {
- int old = this.defaultPrecision;
- this.defaultPrecision = precision;
- this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision);
- }
-
- protected int buildDefaultPrecision() {
- return DEFAULT_PRECISION;
- }
-
-
- // ********** scale **********
-
- public int getScale() {
- return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale;
- }
-
- public Integer getSpecifiedScale() {
- return this.specifiedScale;
- }
-
- protected void setSpecifiedScale(Integer scale) {
- Integer old = this.specifiedScale;
- this.specifiedScale = scale;
- this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale);
- }
-
- protected Integer buildSpecifiedScale() {
- return this.getOverriddenColumn().getSpecifiedScale();
- }
-
- public int getDefaultScale() {
- return this.defaultScale;
- }
-
- protected void setDefaultScale(int scale) {
- int old = this.defaultScale;
- this.defaultScale = scale;
- this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale);
- }
-
- protected int buildDefaultScale() {
- return DEFAULT_SCALE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java
deleted file mode 100644
index 3c1d4571c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java
+++ /dev/null
@@ -1,135 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualBaseColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * <code>orm.xml</code> virtual join column
- */
-public class GenericOrmVirtualJoinColumn
- extends AbstractOrmVirtualBaseColumn<OrmReadOnlyJoinColumn.Owner, ReadOnlyJoinColumn>
- implements OrmVirtualJoinColumn
-{
- protected final ReadOnlyJoinColumn overriddenColumn;
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericOrmVirtualJoinColumn(XmlContextNode parent, OrmReadOnlyJoinColumn.Owner owner, ReadOnlyJoinColumn 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 ReadOnlyJoinColumn 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);
- }
-
-
- // ********** 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 **********
-
- @Override
- protected String buildDefaultName() {
- return MappingTools.buildJoinColumnDefaultName(this, this.owner);
- }
-
-
- // ********** validation **********
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.getValidationTextRange();
- }
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver() {
- return new OrmJoinColumnTextRangeResolver(this);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
deleted file mode 100644
index 91200aea95..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java
+++ /dev/null
@@ -1,256 +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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.OverrideRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn.Owner;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmVirtualOverrideJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MappingRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverride2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmVirtualOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.db.Table;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class 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() {
- return this.isJpa2_0Compatible() ?
- this.buildStrategy2_0() :
- this.joinColumnStrategy;
- }
-
- /**
- * The overridden mapping determines the override's strategy.
- */
- protected OrmVirtualRelationshipStrategy buildStrategy2_0() {
- MappingRelationshipStrategy2_0 mappingStrategy = this.getMappingStrategy();
- return (mappingStrategy != null) ?
- (OrmVirtualRelationshipStrategy) mappingStrategy.selectOverrideStrategy(this) :
- this.buildMissingMappingStrategy();
- }
-
- /**
- * Get the strategy from the overridden mapping.
- */
- protected MappingRelationshipStrategy2_0 getMappingStrategy() {
- RelationshipMapping mapping = this.getMapping();
- return (mapping == null) ? null : (MappingRelationshipStrategy2_0) mapping.getRelationship().getStrategy();
- }
-
- /**
- * Return the strategy to use when the override's name does not match the
- * name of an appropriate relationship mapping.
- */
- protected OrmVirtualRelationshipStrategy buildMissingMappingStrategy() {
- return this.joinColumnStrategy.hasSpecifiedJoinColumns() ?
- this.joinColumnStrategy :
- this.joinTableStrategy;
- }
-
-
- // ********** join column strategy **********
-
- public OrmVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy() {
- return this.joinColumnStrategy;
- }
-
- public boolean strategyIsJoinColumn() {
- return this.strategy == this.joinColumnStrategy;
- }
-
- public boolean mayHaveDefaultJoinColumn() {
- // association overrides do not have defaults
- 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() {
- // association overrides do not have defaults
- return false;
- }
-
- 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();
- }
-
- protected OrmVirtualAssociationOverride getAssociationOverride() {
- return this.getParent();
- }
-
- protected OrmAssociationOverride2_0 getAssociationOverride2_0() {
- return (OrmAssociationOverride2_0) this.getAssociationOverride();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getAssociationOverride().getTypeMapping();
- }
-
- public String getAttributeName() {
- return this.getAssociationOverride().getName();
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return this.getAssociationOverride().tableNameIsInvalid(tableName);
- }
-
- public Iterable<String> getCandidateTableNames() {
- return this.getAssociationOverride().getCandidateTableNames();
- }
-
- public Table resolveDbTable(String tableName) {
- return this.getAssociationOverride().resolveDbTable(tableName);
- }
-
- public String getDefaultTableName() {
- return this.getAssociationOverride().getDefaultTableName();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyBaseColumn column, Owner owner, BaseColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride().buildColumnValidator(column, owner, textRangeResolver);
- }
-
- 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 ReadOnlyRelationship resolveOverriddenRelationship() {
- return this.getAssociationOverride().resolveOverriddenRelationship();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getAssociationOverride().getValidationTextRange();
- }
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.strategy.validate(messages, reporter);
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyJoinTable table, TableTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableValidator(table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getAssociationOverride2_0().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java
deleted file mode 100644
index 4d7e1f9e36..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java
+++ /dev/null
@@ -1,133 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmPrimaryKeyJoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.db.Column;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * <code>orm.xml</code> virtual primary key join column
- */
-public class GenericOrmVirtualPrimaryKeyJoinColumn
- extends AbstractOrmVirtualNamedColumn<OrmReadOnlyBaseJoinColumn.Owner, JavaPrimaryKeyJoinColumn>
- implements OrmVirtualPrimaryKeyJoinColumn
-{
- protected final JavaPrimaryKeyJoinColumn javaColumn;
-
- protected String specifiedReferencedColumnName;
- protected String defaultReferencedColumnName;
-
-
- public GenericOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, OrmReadOnlyBaseJoinColumn.Owner owner, JavaPrimaryKeyJoinColumn javaColumn) {
- super(parent, owner);
- this.javaColumn = javaColumn;
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
-
- this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName());
- this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName());
- }
-
-
- // ********** column **********
-
- @Override
- public JavaPrimaryKeyJoinColumn getOverriddenColumn() {
- return this.javaColumn;
- }
-
- 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();
- }
-
-
- // ********** 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 String getTable() {
- return this.owner.getDefaultTableName();
- }
-
-
- // ********** validation **********
-
- @Override
- protected NamedColumnTextRangeResolver buildTextRangeResolver() {
- return new OrmPrimaryKeyJoinColumnTextRangeResolver(this);
- }
-
- public TextRange getReferencedColumnNameTextRange() {
- return this.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java
deleted file mode 100644
index 3b2c7d8298..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint;
-
-public class GenericOrmVirtualUniqueConstraint
- extends AbstractOrmReadOnlyUniqueConstraint
- implements OrmVirtualUniqueConstraint
-{
- protected final ReadOnlyUniqueConstraint overriddenUniqueConstraint;
-
-
- public GenericOrmVirtualUniqueConstraint(XmlContextNode parent, ReadOnlyUniqueConstraint overriddenUniqueConstraint) {
- super(parent);
- this.overriddenUniqueConstraint = overriddenUniqueConstraint;
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void update() {
- super.update();
- this.syncColumnNames();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getParent().getValidationTextRange();
- }
-
-
- // ********** misc **********
-
- @Override
- public XmlContextNode getParent() {
- return (XmlContextNode) super.getParent();
- }
-
- public ReadOnlyUniqueConstraint getOverriddenUniqueConstraint() {
- return this.overriddenUniqueConstraint;
- }
-
- @Override
- protected Iterable<String> getResourceColumnNames() {
- return this.overriddenUniqueConstraint.getColumnNames();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java
deleted file mode 100644
index e9d9575c61..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.List;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXml;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * JPA <code>orm.xml</code> file.
- */
-public class GenericOrmXml
- extends AbstractOrmXmlContextNode
- implements OrmXml
-{
- /**
- * If the XML resource's content type changes, the mapping file
- * ref will throw out its current mapping file.
- */
- protected final JpaXmlResource xmlResource; // never null
-
- /**
- * The 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;
-
- /**
- * Cache the <code>orm.xml</code> definition alongside the resource type.
- * (The definition is determined by the resource type.)
- */
- protected OrmXmlDefinition definition;
-
- /**
- * 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();
- this.definition = this.buildDefinition();
-
- XmlEntityMappings xmlEntityMappings = (XmlEntityMappings) xmlResource.getRootObject();
- if (xmlEntityMappings != null) {
- this.root = this.buildRoot(xmlEntityMappings);
- }
- }
-
-
- // ********** synchronize/update **********
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml#synchronizeWithResourceModel()
- */
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- XmlEntityMappings oldXmlEntityMappings = (this.root == null) ? null : this.root.getXmlEntityMappings();
- XmlEntityMappings newXmlEntityMappings = (XmlEntityMappings) this.xmlResource.getRootObject();
- JptResourceType newResourceType = this.xmlResource.getResourceType();
-
- // If the old and new XML entity mappings are different instances,
- // we scrap the old context entity mappings and rebuild.
- // (This can happen when the resource model changes drastically,
- // such as a CVS checkout or an edit reversion.)
- if ((oldXmlEntityMappings != newXmlEntityMappings) ||
- (newXmlEntityMappings == null) ||
- this.valuesAreDifferent(this.resourceType, newResourceType)
- ) {
- if (this.root != null) {
- this.unregisterRootStructureNode();
- this.root.dispose();
- this.setRoot(null);
- }
- }
-
- this.resourceType = newResourceType;
- this.definition = this.buildDefinition();
-
- 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();
- }
- }
-
-
- // ********** resource type/definition **********
-
- @Override
- public JptResourceType getResourceType() {
- return this.resourceType;
- }
-
- @Override
- public OrmXmlDefinition getMappingFileDefinition() {
- return this.definition;
- }
-
- protected OrmXmlDefinition buildDefinition() {
- return (OrmXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.resourceType);
- }
-
-
- // ********** root **********
-
- public EntityMappings getRoot() {
- return this.root;
- }
-
- protected void setRoot(EntityMappings root) {
- EntityMappings old = this.root;
- this.root = root;
- this.firePropertyChanged(ROOT_PROPERTY, old, root);
- }
-
- protected EntityMappings buildRoot(XmlEntityMappings xmlEntityMappings) {
- return this.getContextNodeFactory().buildEntityMappings(this, xmlEntityMappings);
- }
-
-
- // ********** misc **********
-
- protected void checkXmlResource(JpaXmlResource resource) {
- if (resource == null) {
- throw new NullPointerException();
- }
- if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE)) {
- throw new IllegalArgumentException("Content type is not 'mapping file': " + resource); //$NON-NLS-1$
- }
- }
-
- @Override
- public MappingFileRef getParent() {
- return (MappingFileRef) super.getParent();
- }
-
- @Override
- public IResource getResource() {
- return this.xmlResource.getFile();
- }
-
- 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() {
- // since this is the entire file, point to the top of the file
- return TextRange.Empty.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java
deleted file mode 100644
index 3a2dbdaa5a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import java.util.ArrayList;
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEntityDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmMappedSuperclassDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-
-public class GenericOrmXmlDefinition
- extends AbstractOrmXmlDefinition
-{
- // singleton
- private static final OrmXmlDefinition INSTANCE = new GenericOrmXmlDefinition();
-
- /**
- * Return the singleton
- */
- public static OrmXmlDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private GenericOrmXmlDefinition() {
- super();
- }
-
- public JptResourceType getResourceType() {
- return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE;
- }
-
- public EFactory getResourceNodeFactory() {
- return OrmFactory.eINSTANCE;
- }
-
- @Override
- protected OrmXmlContextNodeFactory buildContextNodeFactory() {
- return new GenericOrmXmlContextNodeFactory();
- }
-
- @Override
- protected void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS);
- }
-
- /**
- * Order should not matter here; but we'll use the same order as for Java.
- * @see GenericJpaPlatformProvider
- */
- protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] {
- OrmEntityDefinition.instance(),
- OrmEmbeddableDefinition.instance(),
- OrmMappedSuperclassDefinition.instance()
- };
-
- @Override
- protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, ATTRIBUTE_MAPPING_DEFINITIONS);
- }
-
- /**
- * Order should not matter here; but we'll use the same order as for Java.
- * @see GenericJpaPlatformProvider
- */
- protected static final OrmAttributeMappingDefinition[] ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] {
- OrmTransientMappingDefinition.instance(),
- OrmIdMappingDefinition.instance(),
- OrmVersionMappingDefinition.instance(),
- OrmBasicMappingDefinition.instance(),
- OrmEmbeddedMappingDefinition.instance(),
- OrmEmbeddedIdMappingDefinition.instance(),
- OrmManyToManyMappingDefinition.instance(),
- OrmManyToOneMappingDefinition.instance(),
- OrmOneToManyMappingDefinition.instance(),
- OrmOneToOneMappingDefinition.instance(),
- NullOrmAttributeMappingDefinition.instance()
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java
deleted file mode 100644
index 9915124912..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java
+++ /dev/null
@@ -1,54 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class NullOrmConverter
- extends AbstractOrmConverter
-{
- public NullOrmConverter(OrmAttributeMapping parent) {
- super(parent);
- }
-
- public void initialize() {
- // NOP
- }
-
- public Class<? extends Converter> getType() {
- return null;
- }
-
- @Override
- protected TextRange getXmlValidationTextRange() {
- return null;
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return EmptyIterable.instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return EmptyIterable.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
deleted file mode 100644
index 5cd0538991..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java
+++ /dev/null
@@ -1,171 +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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.JoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationship;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.ReadOnlyOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMappingJoinColumnRelationshipStrategy2_0;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- * Used by
- * {@link org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOneToManyRelationship#buildJoinColumnStrategy()}
- * in a JPA 1.0 project.
- */
-public class NullOrmJoinColumnRelationshipStrategy
- extends AbstractOrmXmlContextNode
- implements OrmMappingJoinColumnRelationshipStrategy2_0
-{
- public NullOrmJoinColumnRelationshipStrategy(OrmJoinColumnRelationship parent) {
- super(parent);
- }
-
-
- // ********** join columns **********
-
- public ListIterable<OrmJoinColumn> getJoinColumns() {
- return EmptyListIterable.<OrmJoinColumn>instance();
- }
-
- public int getJoinColumnsSize() {
- return 0;
- }
-
-
- // ********** specified join columns **********
-
- public ListIterable<OrmJoinColumn> getSpecifiedJoinColumns() {
- return EmptyListIterable.<OrmJoinColumn>instance();
- }
-
- public int getSpecifiedJoinColumnsSize() {
- 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 this.getRelationship().getValidationTextRange();
- }
-
- 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 ReadOnlyRelationshipStrategy selectOverrideStrategy(ReadOnlyOverrideRelationship2_0 overrideRelationship) {
- return null;
- }
-
- public void addStrategy() {
- // NOP
- }
-
- public void removeStrategy() {
- // NOP
- }
-
- public boolean isTargetForeignKey() {
- return false;
- }
-
- public TypeMapping getRelationshipTarget() {
- return null;
- }
-
- public String getTableName() {
- return null;
- }
-
- public boolean isOverridable() {
- return false;
- }
-
- public boolean tableNameIsInvalid(String tableName) {
- return true;
- }
-
- public Table resolveDbTable(String tableName) {
- return null;
- }
-
- public TypeMapping getRelationshipSource() {
- return this.getRelationshipMapping().getTypeMapping();
- }
-
- protected RelationshipMapping getRelationshipMapping() {
- return this.getRelationship().getMapping();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java
deleted file mode 100644
index 1cba7cb9d6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping;
-
-/**
- * This will be used in cases where Java-supported attribute mapping types
- * are not supported by the particular version of the <code>orm.xml</code>
- * file. For example, EclipseLink supports variable 1:1 mappings, but the
- * generic <code>orm.xml</code> file does not.
- */
-public class UnsupportedOrmAttributeMapping
- extends AbstractOrmAttributeMapping<XmlNullAttributeMapping>
-{
- public UnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping xmlMapping) {
- super(parent, xmlMapping);
- }
-
- public String getKey() {
- //this ends up returning the java attribute mapping key
- return this.xmlAttributeMapping.getMappingKey();
- }
-
- public int getXmlSequence() {
- return -1;
- }
-
- public void initializeOn(OrmAttributeMapping newMapping) {
- newMapping.initializeFromOrmAttributeMapping(this);
- }
-
- public void addXmlAttributeMappingTo(Attributes xmlAttributes) {
- throw new UnsupportedOperationException();
- }
-
- public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** metamodel **********
-
- @Override
- public MetamodelField getMetamodelField() {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
deleted file mode 100644
index ddf31c9991..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java
+++ /dev/null
@@ -1,383 +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.jpa.core.internal.jpa1.context.persistence;
-
-import java.util.List;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.AccessType;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>persistence.xml</code> file
- * <br>
- * <code>class</code> element
- */
-public class GenericClassRef
- extends AbstractPersistenceXmlContextNode
- implements ClassRef
-{
- /**
- * This is <code>null</code> for a <em>virtual</em> class ref.
- */
- protected final XmlJavaClassRef xmlJavaClassRef;
-
- protected String className;
-
- /**
- * The Java persistent type corresponding to the ref's class name;
- * this can be <code>null</code> if the className is invalid or
- * refers to an enum instead of a class or interface.
- */
- 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() {
- JavaResourceType resourceType = this.resolveJavaResourceType();
- 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.getJavaResourceType() == resourceType) {
- this.javaPersistentType.update();
- } else {
- this.javaPersistentType.dispose();
- this.setJavaPersistentType(this.buildJavaPersistentType(resourceType));
- }
- }
- }
- }
-
- protected JavaResourceType resolveJavaResourceType() {
- String javaClassName = this.getJavaClassName();
- return (javaClassName == null) ? null : (JavaResourceType) this.getJpaProject().getJavaResourceType(javaClassName, Kind.TYPE);
- }
-
- protected JavaPersistentType buildJavaPersistentType(JavaResourceType 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 (MappingFileRef mappingFileRef : this.getPersistenceUnit().getMappingFileRefsContaining(this.getJavaClassName())) {
- validateJavaPersistentType = false;
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.LOW_SEVERITY,
- JpaValidationMessages.PERSISTENCE_UNIT_REDUNDANT_CLASS,
- new String[] {this.getJavaClassName(), mappingFileRef.getFileName()},
- this,
- this.getValidationTextRange()
- )
- );
- }
-
- if (validateJavaPersistentType) {
- this.validateJavaPersistentType(messages, reporter);
- }
- }
-
- protected void validateJavaPersistentType(List<IMessage> messages, IReporter reporter) {
- try {
- this.javaPersistentType.validate(messages, reporter);
- } catch (Throwable t) {
- JptJpaCorePlugin.log(t);
- }
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlValidationTextRange();
- return (textRange != null) ? textRange : this.getPersistenceUnit().getValidationTextRange();
- }
-
- public TextRange getXmlValidationTextRange() {
- return this.isVirtual() ? null : this.xmlJavaClassRef.getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java
deleted file mode 100644
index eec257e95c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractJarFileRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
-
-/**
- * Context JAR file reference (from the persistence unit)
- */
-public class GenericJarFileRef
- extends AbstractJarFileRef
-{
- public GenericJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) {
- super(parent, xmlJarFileRef);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
deleted file mode 100644
index 43a0a78e9f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java
+++ /dev/null
@@ -1,154 +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.jpa.core.internal.jpa1.context.persistence;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractMappingFileRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-
-/**
- * <code>persistence.xml</code> file
- * <br>
- * <code>mapping-file</code> element
- */
-public class GenericMappingFileRef
- extends AbstractMappingFileRef
-{
- protected final XmlMappingFileRef xmlMappingFileRef;
-
-
- public GenericMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) {
- super(parent, xmlMappingFileRef.getFileName());
- this.xmlMappingFileRef = xmlMappingFileRef;
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- // set the file name *before* calling super
- this.setFileName_(this.xmlMappingFileRef.getFileName());
- super.synchronizeWithResourceModel();
- }
-
-
- // ********** file name **********
-
- public void setFileName(String fileName) {
- this.setFileName_(fileName);
- this.xmlMappingFileRef.setFileName(fileName);
- }
-
- protected void setFileName_(String xmlFileName) {
- String old = this.fileName;
- this.fileName = xmlFileName;
- if (this.firePropertyChanged(FILE_NAME_PROPERTY, old, xmlFileName)) {
- if (this.mappingFile != null) {
- this.mappingFile.dispose();
- this.setMappingFile(null);
- }
- }
- }
-
-
- // ********** misc **********
-
- public XmlMappingFileRef getXmlMappingFileRef() {
- return this.xmlMappingFileRef;
- }
-
- public boolean isImplied() {
- return false;
- }
-
- public boolean containsOffset(int textOffset) {
- return this.xmlMappingFileRef.containsOffset(textOffset);
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public TextRange getSelectionTextRange() {
- return this.xmlMappingFileRef.getSelectionTextRange();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlValidationTextRange();
- return (textRange != null) ? textRange : this.getPersistenceUnit().getValidationTextRange();
- }
-
- protected TextRange getXmlValidationTextRange() {
- return this.xmlMappingFileRef.getValidationTextRange();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file) {
- return this.isFor(file) ?
- new SingleElementIterable<DeleteEdit>(this.createDeleteEdit()) :
- EmptyIterable.<DeleteEdit>instance();
- }
-
- protected DeleteEdit createDeleteEdit() {
- return this.xmlMappingFileRef.createDeleteEdit();
- }
-
- @Override
- protected ReplaceEdit createRenameEdit(IFile originalFile, String newName) {
- return this.xmlMappingFileRef.createRenameEdit(originalFile, newName);
- }
-
- public Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName) {
- return this.isIn(originalFolder) ?
- new SingleElementIterable<ReplaceEdit>(this.createRenameFolderEdit(originalFolder, newName)) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- protected ReplaceEdit createRenameFolderEdit(IFolder originalFolder, String newName) {
- return this.xmlMappingFileRef.createRenameFolderEdit(originalFolder, newName);
- }
-
- @Override
- protected ReplaceEdit createMoveEdit(IFile originalFile, IPath runtineDestination) {
- return this.xmlMappingFileRef.createMoveEdit(originalFile, runtineDestination);
- }
-
- public Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination) {
- return this.isIn(originalFolder) ?
- new SingleElementIterable<ReplaceEdit>(this.createMoveEdit(originalFolder, runtimeDestination)) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- protected ReplaceEdit createMoveEdit(IFolder originalFolder, IPath runtimeDestination) {
- IProject project = originalFolder.getProject();
- IPath fullPath = originalFolder.getFullPath();
- IPath originalLocation = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath);
- return this.createMoveEdit(originalLocation, runtimeDestination);
- }
-
- protected ReplaceEdit createMoveEdit(IPath originalLocation, IPath runtineDestination) {
- return this.xmlMappingFileRef.createMoveEdit(originalLocation, runtineDestination);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
deleted file mode 100644
index 1e9083278b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java
+++ /dev/null
@@ -1,301 +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.jpa.core.internal.jpa1.context.persistence;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.Persistence2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * <code>persistence.xml</code> file
- * <br>
- * <code>persistence</code> element
- */
-public class GenericPersistence
- extends AbstractPersistenceXmlContextNode
- implements Persistence2_0
-{
- protected final XmlPersistence xmlPersistence;
-
- // The implementation here is a single persistence unit, although the API
- // is for a list. We want to support multiple persistence units someday....
- protected PersistenceUnit persistenceUnit;
-
-
- public GenericPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) {
- super(parent);
- this.xmlPersistence = xmlPersistence;
- this.initializePersistenceUnits();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.syncPersistenceUnits();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateNodes(this.getPersistenceUnits());
- }
-
-
- // ********** persistence units **********
-
- public ListIterable<PersistenceUnit> getPersistenceUnits() {
- return (this.persistenceUnit == null) ? EmptyListIterable.<PersistenceUnit>instance() : this.getPersistenceUnits_();
- }
-
- protected ListIterable<PersistenceUnit> getPersistenceUnits_() {
- return new SingleElementListIterable<PersistenceUnit>(this.persistenceUnit);
- }
-
- public int getPersistenceUnitsSize() {
- return (this.persistenceUnit == null) ? 0 : 1;
- }
-
- public PersistenceUnit addPersistenceUnit() {
- return this.addPersistenceUnit(this.getPersistenceUnitsSize());
- }
-
- 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();
- }
-
- protected PersistenceXml getPersistenceXml() {
- return this.getParent();
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.xmlPersistence.getValidationTextRange();
- return (textRange != null) ? textRange : this.getPersistenceXml().getValidationTextRange();
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- return PersistenceStructureNodes.PERSISTENCE_ID;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- for (PersistenceUnit pu : this.getPersistenceUnits()) {
- if (pu.containsOffset(textOffset)) {
- return pu.getStructureNode(textOffset);
- }
- }
- return this;
- }
-
- public TextRange getSelectionTextRange() {
- return this.xmlPersistence.getSelectionTextRange();
- }
-
- public void dispose() {
- for (PersistenceUnit pu : this.getPersistenceUnits()) {
- pu.dispose();
- }
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- this.validateVersion(messages);
- this.checkForMultiplePersistenceUnits(messages);
- this.validatePersistenceUnit(messages, reporter);
- }
-
- protected void validateVersion(List<IMessage> messages) {
- if (! this.getLatestDocumentVersion().equals(this.xmlPersistence.getVersion())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.LOW_SEVERITY,
- JpaValidationMessages.XML_VERSION_NOT_LATEST,
- this,
- this.xmlPersistence.getVersionTextRange()));
- }
- }
-
- protected String getLatestDocumentVersion() {
- return this.getJpaPlatform().getMostRecentSupportedResourceType(
- JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion();
- }
-
- /**
- * extraneous persistence units can be
- * accessed through the XmlPersistence resource object
- */
- protected void checkForMultiplePersistenceUnits(List<IMessage> messages) {
- if (this.xmlPersistence.getPersistenceUnits().size() > 1) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- JpaValidationMessages.PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS,
- this,
- this.getValidationTextRange()
- )
- );
- }
- }
-
- protected void validatePersistenceUnit(List<IMessage> messages, IReporter reporter) {
- if (this.persistenceUnit == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT,
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
- this.persistenceUnit.validate(messages, reporter);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java
deleted file mode 100644
index d7adff868b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
-
-/**
- * generic <code>persistence-unit</code>
- */
-public class GenericPersistenceUnit
- extends AbstractPersistenceUnit
-{
- public GenericPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
- super(parent, xmlPersistenceUnit);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java
deleted file mode 100644
index 66e1110763..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java
+++ /dev/null
@@ -1,160 +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.jpa.core.internal.jpa1.context.persistence;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty;
-import org.eclipse.text.edits.ReplaceEdit;
-
-/**
- * Straightforward implementation of the persistence unit property.
- * Notifies the persistence unit of any changes to the property.
- */
-public class GenericPersistenceUnitProperty
- extends AbstractPersistenceXmlContextNode
- implements PersistenceUnit.Property
-{
- protected final XmlProperty xmlProperty;
- protected String name;
- protected String value;
-
-
- public GenericPersistenceUnitProperty(PersistenceUnit parent, XmlProperty xmlProperty) {
- super(parent);
- this.xmlProperty = xmlProperty;
- this.name = xmlProperty.getName();
- this.value = xmlProperty.getValue();
- }
-
- @Override
- public PersistenceUnit getParent() {
- return (PersistenceUnit) super.getParent();
- }
-
- public XmlProperty getXmlProperty() {
- return this.xmlProperty;
- }
-
-
- // ********** synchronize **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setName_(this.xmlProperty.getName());
- this.setValue_(this.xmlProperty.getValue());
- }
-
-
- // ********** name **********
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.setName_(name);
- this.xmlProperty.setName(name);
- }
-
- protected void setName_(String name) {
- String old = this.name;
- this.name = name;
- if (this.firePropertyChanged(NAME_PROPERTY, old, name)) {
- this.getPersistenceUnit().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.getPersistenceUnit().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() {
- TextRange textRange = this.xmlProperty.getValidationTextRange();
- return (textRange != null) ? textRange : this.getPersistenceUnit().getValidationTextRange();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<ReplaceEdit> createRenameTypeEdits(IType originalType, String newName) {
- return Tools.valuesAreEqual(this.value, originalType.getFullyQualifiedName('.')) ?
- new SingleElementIterable<ReplaceEdit>(this.createRenameTypeEdit(originalType, newName)) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- protected ReplaceEdit createRenameTypeEdit(IType originalType, String newName) {
- return this.xmlProperty.createRenameTypeEdit(originalType, newName);
- }
-
- public Iterable<ReplaceEdit> createMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return Tools.valuesAreEqual(this.value, originalType.getFullyQualifiedName('.')) ?
- new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newPackage.getElementName())) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- public Iterable<ReplaceEdit> createRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return Tools.valuesAreEqual(this.getValuePackageName(), originalPackage.getElementName()) ?
- new SingleElementIterable<ReplaceEdit>(this.createRenamePackageEdit(newName)) :
- EmptyIterable.<ReplaceEdit>instance();
- }
-
- protected ReplaceEdit createRenamePackageEdit(String newName) {
- return this.xmlProperty.createRenamePackageEdit(newName);
- }
-
-
- // ********** misc **********
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- sb.append(" = "); //$NON-NLS-1$
- sb.append(this.value);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
deleted file mode 100644
index d3ca90ee9b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java
+++ /dev/null
@@ -1,251 +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.jpa.core.internal.jpa1.context.persistence;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JpaStructureNode;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.Persistence2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceXml2_0;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * context model <code>persistence.xml</code> file
- */
-public class GenericPersistenceXml
- extends AbstractPersistenceXmlContextNode
- implements PersistenceXml2_0
-{
- /**
- * If the XML resource's content type changes, the root context
- * node will throw out its current persistence XML.
- */
- protected final JpaXmlResource xmlResource; // never null
-
- /**
- * The resource type will only change if the XML file's version changes
- * (since, if the content type changes, we get garbage-collected).
- */
- protected JptResourceType resourceType;
-
- /**
- * The root element of the <code>persistence.xml</code> file.
- */
- protected Persistence persistence;
-
-
- public GenericPersistenceXml(JpaRootContextNode parent, JpaXmlResource xmlResource) {
- super(parent);
- this.checkXmlResource(xmlResource);
- this.xmlResource = xmlResource;
- this.resourceType = xmlResource.getResourceType();
-
- XmlPersistence xmlPersistence = (XmlPersistence) xmlResource.getRootObject();
- if (xmlPersistence != null) {
- this.persistence = this.buildPersistence(xmlPersistence);
- }
- }
-
-
- // ********** synchronize/update **********
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml#synchronizeWithResourceModel()
- */
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- XmlPersistence oldXmlPersistence = (this.persistence == null) ? null : this.persistence.getXmlPersistence();
- XmlPersistence newXmlPersistence = (XmlPersistence) this.xmlResource.getRootObject();
- JptResourceType newResourceType = this.xmlResource.getResourceType();
-
- // If the old and new XML persistences are different instances,
- // we scrap the old context persistence and rebuild.
- // (This can happen when the resource model changes drastically,
- // such as a CVS checkout or an edit reversion.)
- if ((oldXmlPersistence != newXmlPersistence) ||
- (newXmlPersistence == null) ||
- this.valuesAreDifferent(this.resourceType, newResourceType)
- ) {
- if (this.persistence != null) {
- this.unregisterRootStructureNode();
- this.persistence.dispose();
- this.setPersistence(null);
- }
- }
-
- this.resourceType = newResourceType;
-
- if (newXmlPersistence != null) {
- if (this.persistence == null) {
- this.setPersistence(this.buildPersistence(newXmlPersistence));
- } else {
- // the context persistence already holds the XML persistence
- this.persistence.synchronizeWithResourceModel();
- }
- }
- }
-
- @Override
- public void update() {
- super.update();
- if (this.persistence != null) {
- this.persistence.update();
- // this will happen redundantly - need to hold JpaFile?
- this.registerRootStructureNode();
- }
- }
-
-
- // ********** persistence **********
-
- public Persistence getPersistence() {
- return this.persistence;
- }
-
- protected void setPersistence(Persistence persistence) {
- Persistence old = this.persistence;
- this.persistence = persistence;
- this.firePropertyChanged(PERSISTENCE_PROPERTY, old, persistence);
- }
-
- protected Persistence buildPersistence(XmlPersistence xmlPersistence) {
- return this.getContextNodeFactory().buildPersistence(this, xmlPersistence);
- }
-
-
- // ********** misc **********
-
- protected void checkXmlResource(JpaXmlResource resource) {
- if (resource == null) {
- throw new NullPointerException();
- }
- if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- throw new IllegalArgumentException("Content type is not 'persistence': " + resource); //$NON-NLS-1$
- }
- }
-
- public JpaXmlResource getXmlResource() {
- return this.xmlResource;
- }
-
- @Override
- public IResource getResource() {
- return this.xmlResource.getFile();
- }
-
- @Override
- public JptResourceType getResourceType() {
- return this.xmlResource.getResourceType();
- }
-
- protected JpaFile getJpaFile() {
- return this.getJpaFile(this.xmlResource.getFile());
- }
-
-
- // ********** metamodel **********
-
- public void initializeMetamodel() {
- if (this.persistence != null) {
- ((Persistence2_0) this.persistence).initializeMetamodel();
- }
- }
-
- public void synchronizeMetamodel() {
- if (this.persistence != null) {
- ((Persistence2_0) this.persistence).synchronizeMetamodel();
- }
- }
-
- public void disposeMetamodel() {
- if (this.persistence != null) {
- ((Persistence2_0) this.persistence).disposeMetamodel();
- }
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public String getId() {
- // isn't actually displayed, so needs no details page
- return null;
- }
-
- public JpaStructureNode getStructureNode(int textOffset) {
- if (this.persistence.containsOffset(textOffset)) {
- return this.persistence.getStructureNode(textOffset);
- }
- return this;
- }
-
- // never actually selected
- public TextRange getSelectionTextRange() {
- return TextRange.Empty.instance();
- }
-
- public void dispose() {
- if (this.persistence != null) {
- JpaFile jpaFile = this.getJpaFile();
- if (jpaFile != null) {
- this.unregisterRootStructureNode();
- }
- this.persistence.dispose();
- }
- }
-
- // TODO hold the JpaFile?
- protected void registerRootStructureNode() {
- this.getJpaFile().addRootStructureNode(this.xmlResource, this.persistence);
- }
-
- protected void unregisterRootStructureNode() {
- this.getJpaFile().removeRootStructureNode(this.xmlResource, this.persistence);
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
-
- if (this.persistence == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENCE_XML_INVALID_CONTENT,
- this
- )
- );
- return;
- }
-
- this.persistence.validate(messages, reporter);
- }
-
- public TextRange getValidationTextRange() {
- // since this is the entire file, point to the top of the file
- return TextRange.Empty.instance();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java
deleted file mode 100644
index 57d9a22b6e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.GenericPersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
-
-public class GenericPersistenceXmlDefinition
- extends AbstractPersistenceXmlDefinition
-{
- // singleton
- private static final PersistenceXmlDefinition INSTANCE = new GenericPersistenceXmlDefinition();
-
- /**
- * Return the singleton
- */
- public static PersistenceXmlDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private GenericPersistenceXmlDefinition() {
- super();
- }
-
- public JptResourceType getResourceType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE;
- }
-
- public EFactory getResourceNodeFactory() {
- return PersistenceFactory.eINSTANCE;
- }
-
- @Override
- protected PersistenceXmlContextNodeFactory buildContextNodeFactory() {
- return new GenericPersistenceXmlContextNodeFactory();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java
deleted file mode 100644
index dca36559d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa1.context.persistence;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractMappingFileRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-
-/**
- * Used by the persistence unit for the
- * <code>META-INF/orm.xml</code> file when it is not explicitly listed
- * in the <code>persistence.xml</code> file.
- */
-public class ImpliedMappingFileRef
- extends AbstractMappingFileRef
-{
-
- // ********** construction/initialization **********
-
- public ImpliedMappingFileRef(PersistenceUnit parent, String fileName) {
- super(parent, fileName);
- }
-
-
- // ********** MappingFileRef implementation **********
-
- public XmlMappingFileRef getXmlMappingFileRef() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isImplied() {
- return true;
- }
-
- public void setFileName(String fileName) {
- throw new UnsupportedOperationException("Cannot set an implied mapping file ref's 'fileName': " + fileName); //$NON-NLS-1$
- }
-
- public boolean containsOffset(int textOffset) {
- return false;
- }
-
-
- // ********** JpaStructureNode implementation **********
-
- public TextRange getSelectionTextRange() {
- return null;
- }
-
-
- // ********** XmlContextNode implementation **********
-
- public TextRange getValidationTextRange() {
- return this.getPersistenceUnit().getValidationTextRange();
- }
-
-
- // ********** refactoring **********
-
- public Iterable<DeleteEdit> createDeleteMappingFileEdits(IFile file) {
- throw new IllegalStateException("This reference cannot be deleted - it is implied"); //$NON-NLS-1$
- }
-
- public Iterable<ReplaceEdit> createRenameFolderEdits(IFolder originalFolder, String newName) {
- throw new IllegalStateException("This reference cannot be moved - it is implied"); //$NON-NLS-1$
- }
-
- @Override
- protected ReplaceEdit createRenameEdit(IFile originalFile, String newName) {
- return this.createReplaceEdit(this.fileName.substring(0, this.fileName.lastIndexOf('/') + 1) + newName);
- }
-
- @Override
- protected ReplaceEdit createMoveEdit(IFile originalFile, IPath runtimeDestination) {
- return this.createReplaceEdit(runtimeDestination.append(originalFile.getName()).toString());
- }
-
- protected ReplaceEdit createReplaceEdit(String newMappingFileName) {
- StringBuilder sb = new StringBuilder();
- sb.append(StringTools.CR);
- sb.append("\t\t<mapping-file>"); //$NON-NLS-1$
- sb.append(newMappingFileName);
- sb.append("</mapping-file>"); //$NON-NLS-1$
- int offset = this.getPersistenceUnit().findInsertLocationForMappingFileRef();
- return new ReplaceEdit(offset, 0, sb.toString());
- }
-
- public Iterable<ReplaceEdit> createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination) {
- throw new IllegalStateException("This reference cannot be moved - it is implied"); //$NON-NLS-1$
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
deleted file mode 100644
index a9e3b009a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java
+++ /dev/null
@@ -1,27 +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.jpa.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public final class BinaryAssociationOverride1_0Annotation
- extends BinaryAssociationOverrideAnnotation
-{
-
- public BinaryAssociationOverride1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
deleted file mode 100644
index 34bd911323..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java
+++ /dev/null
@@ -1,27 +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.jpa.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
-
-/**
- * javax.persistence.NamedQuery
- */
-public final class BinaryNamedQuery1_0Annotation
- extends BinaryNamedQueryAnnotation
-{
-
- public BinaryNamedQuery1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
deleted file mode 100644
index 8079c4b62b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java
+++ /dev/null
@@ -1,27 +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.jpa.core.internal.jpa1.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
-
-/**
- * javax.persistence.SequenceGenerator
- */
-public final class BinarySequenceGenerator1_0Annotation
- extends BinarySequenceGeneratorAnnotation
-{
-
- public BinarySequenceGenerator1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
deleted file mode 100644
index 987867e3c4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java
+++ /dev/null
@@ -1,77 +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.jpa.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
-
-/**
- * <code>javax.persistence.AssociationOverride</code>
- */
-public final class SourceAssociationOverride1_0Annotation
- extends SourceAssociationOverrideAnnotation
-{
-
- public static SourceAssociationOverride1_0Annotation buildSourceAssociationOverrideAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element) {
-
- return new SourceAssociationOverride1_0Annotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public static SourceAssociationOverride1_0Annotation buildSourceAssociationOverrideAnnotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement annotatedElement,
- int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildAssociationOverrideDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildAssociationOverrideAnnotationAdapter(annotatedElement, idaa);
- return new SourceAssociationOverride1_0Annotation(
- parent,
- annotatedElement,
- idaa,
- iaa);
- }
-
- public static SourceAssociationOverride1_0Annotation buildNestedSourceAssociationOverrideAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- return new SourceAssociationOverride1_0Annotation(parent, element, idaa);
- }
-
- private SourceAssociationOverride1_0Annotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- DeclarationAnnotationAdapter daa) {
-
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- private SourceAssociationOverride1_0Annotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
- }
-
- private SourceAssociationOverride1_0Annotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, daa, annotationAdapter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
deleted file mode 100644
index 3ce0b644b0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java
+++ /dev/null
@@ -1,41 +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.jpa.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation;
-
-/**
- * <code>javax.persistence.NamedQuery</code>
- */
-public final class SourceNamedQuery1_0Annotation
- extends SourceNamedQueryAnnotation
-{
- public static SourceNamedQuery1_0Annotation buildSourceNamedQueryAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildNamedQueryDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildNamedQueryAnnotationAdapter(annotatedElement, idaa);
- return new SourceNamedQuery1_0Annotation(
- parent,
- annotatedElement,
- idaa,
- iaa);
- }
-
- private SourceNamedQuery1_0Annotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement annotatedElement,
- IndexedDeclarationAnnotationAdapter daa,
- IndexedAnnotationAdapter annotationAdapter) {
- super(parent, annotatedElement, daa, annotationAdapter);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
deleted file mode 100644
index 99cc3b6c72..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java
+++ /dev/null
@@ -1,27 +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.jpa.core.internal.jpa1.resource.java.source;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
-
-/**
- * javax.persistence.SequenceGenerator
- */
-public final class SourceSequenceGenerator1_0Annotation
- extends SourceSequenceGeneratorAnnotation
-{
-
- public SourceSequenceGenerator1_0Annotation(JavaResourceNode parent, AnnotatedElement element) {
- super(parent, element);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
deleted file mode 100644
index 948eff2c22..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java
+++ /dev/null
@@ -1,171 +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.jpa.core.internal.jpa2;
-
-import java.util.ArrayList;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Access2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.AssociationOverride2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Cacheable2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.CollectionTable2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.ElementCollection2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.GeneratedAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyClass2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyEnumerated2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyJoinColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyJoinColumns2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyTemporal2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapsId2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NamedQuery2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.SequenceGenerator2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.StaticMetamodelAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverridesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverrideAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverridesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.BasicAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.ColumnAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorValueAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedIdAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EntityAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.EnumeratedAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.GeneratedValueAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.IdAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.IdClassAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.InheritanceAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.JoinTableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.LobAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToManyAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToOneAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.MapKeyAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.MappedSuperclassAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueryAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NamedQueriesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.OneToManyAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.OneToOneAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.OrderByAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTablesAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.TableAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.TableGeneratorAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.TemporalAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.TransientAnnotationDefinition;
-import org.eclipse.jpt.jpa.core.internal.resource.java.VersionAnnotationDefinition;
-
-/**
- * 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 addAnnotationDefinitionsTo(ArrayList<AnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, ANNOTATION_DEFINITIONS);
- }
-
- protected static final AnnotationDefinition[] ANNOTATION_DEFINITIONS = new AnnotationDefinition[] {
- AttributeOverridesAnnotationDefinition.instance(),
- AssociationOverridesAnnotationDefinition.instance(),
- Access2_0AnnotationDefinition.instance(),
- BasicAnnotationDefinition.instance(),
- Cacheable2_0AnnotationDefinition.instance(),
- CollectionTable2_0AnnotationDefinition.instance(),
- ColumnAnnotationDefinition.instance(),
- DiscriminatorColumnAnnotationDefinition.instance(),
- DiscriminatorValueAnnotationDefinition.instance(),
- ElementCollection2_0AnnotationDefinition.instance(),
- EmbeddableAnnotationDefinition.instance(),
- EmbeddedAnnotationDefinition.instance(),
- EmbeddedIdAnnotationDefinition.instance(),
- EntityAnnotationDefinition.instance(),
- EnumeratedAnnotationDefinition.instance(),
- GeneratedAnnotationDefinition.instance(),
- GeneratedValueAnnotationDefinition.instance(),
- IdAnnotationDefinition.instance(),
- IdClassAnnotationDefinition.instance(),
- InheritanceAnnotationDefinition.instance(),
- JoinColumnsAnnotationDefinition.instance(),
- JoinTableAnnotationDefinition.instance(),
- LobAnnotationDefinition.instance(),
- ManyToManyAnnotationDefinition.instance(),
- ManyToOneAnnotationDefinition.instance(),
- MappedSuperclassAnnotationDefinition.instance(),
- MapsId2_0AnnotationDefinition.instance(),
- MapKeyAnnotationDefinition.instance(),
- MapKeyClass2_0AnnotationDefinition.instance(),
- MapKeyColumn2_0AnnotationDefinition.instance(),
- MapKeyEnumerated2_0AnnotationDefinition.instance(),
- MapKeyJoinColumns2_0AnnotationDefinition.instance(),
- MapKeyTemporal2_0AnnotationDefinition.instance(),
- NamedQueriesAnnotationDefinition.instance(),
- NamedNativeQueriesAnnotationDefinition.instance(),
- OneToManyAnnotationDefinition.instance(),
- OneToOneAnnotationDefinition.instance(),
- OrderByAnnotationDefinition.instance(),
- OrderColumn2_0AnnotationDefinition.instance(),
- PrimaryKeyJoinColumnsAnnotationDefinition.instance(),
- SecondaryTablesAnnotationDefinition.instance(),
- SequenceGenerator2_0AnnotationDefinition.instance(),
- StaticMetamodelAnnotationDefinition.instance(),
- TableAnnotationDefinition.instance(),
- TableGeneratorAnnotationDefinition.instance(),
- TemporalAnnotationDefinition.instance(),
- TransientAnnotationDefinition.instance(),
- VersionAnnotationDefinition.instance()
- };
-
- @Override
- protected void addNestableAnnotationDefinitionsTo(ArrayList<NestableAnnotationDefinition> definitions) {
- CollectionTools.addAll(definitions, NESTABLE_ANNOTATION_DEFINITIONS);
- }
-
- protected static final NestableAnnotationDefinition[] NESTABLE_ANNOTATION_DEFINITIONS = new NestableAnnotationDefinition[] {
- AssociationOverride2_0AnnotationDefinition.instance(),
- AttributeOverrideAnnotationDefinition.instance(),
- JoinColumnAnnotationDefinition.instance(),
- MapKeyJoinColumn2_0AnnotationDefinition.instance(),
- NamedQuery2_0AnnotationDefinition.instance(),
- NamedNativeQueryAnnotationDefinition.instance(),
- PrimaryKeyJoinColumnAnnotationDefinition.instance(),
- SecondaryTableAnnotationDefinition.instance(),
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
deleted file mode 100644
index 6a0db9b94a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.jpa2;
-
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
-import org.eclipse.jpt.jpa.core.JpaPlatformVariation;
-import org.eclipse.jpt.jpa.core.internal.JpaAnnotationProvider;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform;
-import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class Generic2_0JpaPlatformFactory
- implements JpaPlatformFactory
-{
- /**
- * zero-argument constructor
- */
- public Generic2_0JpaPlatformFactory() {
- super();
- }
-
-
- public JpaPlatform buildJpaPlatform(String id) {
- return new GenericJpaPlatform(
- id,
- this.buildJpaVersion(),
- new GenericJpaFactory2_0(),
- new JpaAnnotationProvider(Generic2_0JpaAnnotationDefinitionProvider.instance()),
- Generic2_0JpaPlatformProvider.instance(),
- this.buildJpaPlatformVariation());
- }
-
- private JpaPlatform.Version buildJpaVersion() {
- return new SimpleVersion(JpaFacet.VERSION_2_0.getVersionString());
- }
-
- protected JpaPlatformVariation buildJpaPlatformVariation() {
- return new JpaPlatformVariation() {
- //table_per_class inheritance support is optional in the 2.0 spec
- public Supported getTablePerConcreteClassInheritanceIsSupported() {
- return Supported.MAYBE;
- }
- public boolean isJoinTableOverridable() {
- return true;
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
deleted file mode 100644
index 6e3847bb5a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java
+++ /dev/null
@@ -1,170 +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.jpa.core.internal.jpa2;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.JpaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.ResourceDefinition;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaBasicMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaElementCollectionMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEmbeddableDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEmbeddedIdMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEmbeddedMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEntityDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaIdMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToManyMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToOneMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaMappedSuperclassDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToManyMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToOneMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaVersionMappingDefinition2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.Generic2_0PersistenceXmlDefinition;
-
-/**
- * All the state in the JPA platform should be "static" (i.e. unchanging once
- * it is initialized).
- */
-public class Generic2_0JpaPlatformProvider
- extends AbstractJpaPlatformProvider
-{
- // singleton
- private static final JpaPlatformProvider INSTANCE = new Generic2_0JpaPlatformProvider();
-
- /**
- * Return the singleton
- */
- public static JpaPlatformProvider instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private Generic2_0JpaPlatformProvider() {
- super();
- }
-
-
- // ********** resource models **********
-
- public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) {
- if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) {
- return JptCommonCorePlugin.JAR_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
- }
- else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) {
- return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
- }
- else {
- throw new IllegalArgumentException(contentType.toString());
- }
- }
-
- @Override
- protected void addResourceModelProvidersTo(ArrayList<JpaResourceModelProvider> providers) {
- CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS);
- }
-
- // order should not be important here
- protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] {
- JavaResourceModelProvider.instance(),
- JarResourceModelProvider.instance(),
- PersistenceResourceModelProvider.instance(),
- OrmResourceModelProvider.instance()
- };
-
-
- // ********** Java type mappings **********
-
- @Override
- protected void addJavaTypeMappingDefinitionsTo(ArrayList<JavaTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS);
- }
-
- // order matches that used by the Reference Implementation (EclipseLink)
- protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] {
- JavaEntityDefinition2_0.instance(),
- JavaEmbeddableDefinition2_0.instance(),
- JavaMappedSuperclassDefinition2_0.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(),
- JavaBasicMappingDefinition2_0.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(),
- JavaVersionMappingDefinition2_0.instance(),
- JavaBasicMappingDefinition2_0.instance(),
- JavaEmbeddedMappingDefinition2_0.instance(),
- JavaEmbeddedIdMappingDefinition2_0.instance(),
- JavaManyToManyMappingDefinition2_0.instance(),
- JavaManyToOneMappingDefinition2_0.instance(),
- JavaOneToManyMappingDefinition2_0.instance(),
- JavaOneToOneMappingDefinition2_0.instance()
- };
-
-
- // ********** resource definitions **********
-
- @Override
- protected void addResourceDefinitionsTo(ArrayList<ResourceDefinition> definitions) {
- CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS);
- }
-
- protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] {
- GenericPersistenceXmlDefinition.instance(),
- Generic2_0PersistenceXmlDefinition.instance(),
- GenericOrmXmlDefinition.instance(),
- GenericOrmXml2_0Definition.instance()
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
deleted file mode 100644
index ba5dcfefa7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java
+++ /dev/null
@@ -1,78 +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.jpa.core.internal.jpa2;
-
-import java.util.Iterator;
-
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JpaDataSource;
-import org.eclipse.jpt.jpa.core.context.JpaRootContextNode;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
-
-/**
- * Conversions are determined by the <code>delimited-identifiers</code>
- * flag in <code>orm.xml</code>.
- * <p>
- * Assume we are in a JPA 2.0-compatible project.
- */
-public class GenericJpaDatabaseIdentifierAdapter
- implements DatabaseIdentifierAdapter
-{
- private final JpaDataSource dataSource;
-
- public GenericJpaDatabaseIdentifierAdapter(JpaDataSource dataSource) {
- super();
- this.dataSource = dataSource;
- }
-
- /**
- * If the flag is set, "identifiers" are treated as "names".
- */
- public boolean treatIdentifiersAsDelimited() {
- return this.getDefaultDelimitedIdentifiers();
- }
-
- 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().getPersistenceUnits().iterator();
- 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();
- }
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, Boolean.valueOf(this.treatIdentifiersAsDelimited()));
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java
deleted file mode 100644
index bcd7e9a919..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java
+++ /dev/null
@@ -1,162 +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.jpa.core.internal.jpa2;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.jpa.core.JpaDataSource;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProject.Config;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaOrderable;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator;
-import org.eclipse.jpt.jpa.core.internal.AbstractJpaFactory;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOrderable;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaCacheable2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaCollectionTable2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaNamedQuery2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrphanRemoval2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaPersistentType2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0;
-import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0.Owner;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter;
-
-
-/**
- * Central class that allows extenders to easily replace implementations of
- * various Dali interfaces.
- */
-public class GenericJpaFactory2_0
- extends AbstractJpaFactory
- implements JpaFactory2_0
-{
-
- public GenericJpaFactory2_0() {
- super();
- }
-
-
- // ********** Core Model **********
-
- @Override
- public JpaProject buildJpaProject(Config config) {
- if ( ! (config instanceof JpaProject2_0.Config)) {
- throw new IllegalArgumentException("config must be 2.0-compatible: " + config); //$NON-NLS-1$
- }
- return super.buildJpaProject(config);
- }
-
- public MetamodelSourceType.Synchronizer buildMetamodelSynchronizer(MetamodelSourceType sourceType) {
- return new GenericMetamodelSynchronizer(sourceType);
- }
-
- public DatabaseIdentifierAdapter buildDatabaseIdentifierAdapter(JpaDataSource dataSource) {
- return new GenericJpaDatabaseIdentifierAdapter(dataSource);
- }
-
-
- // ********** Java Context Model **********
-
- @Override
- public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourceType jrt) {
- return new GenericJavaPersistentType2_0(owner, jrt);
- }
-
- @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, JavaReadOnlyNamedColumn.Owner owner) {
- return new GenericJavaOrderColumn2_0(parent, owner);
- }
-
- public JavaColumn buildJavaMapKeyColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) {
- return new GenericJavaColumn(parent, owner);
- }
-
- public JavaOrderable2_0 buildJavaOrderable(JavaAttributeMapping parent, Owner owner) {
- return new GenericJavaOrderable(parent, owner);
- }
-
- @Override
- public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
deleted file mode 100644
index ecd2df254e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java
+++ /dev/null
@@ -1,434 +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.jpa.core.internal.jpa2;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
-import org.eclipse.jpt.common.core.utility.BodySourceWriter;
-import org.eclipse.jpt.common.utility.internal.ClassName;
-import org.eclipse.jpt.common.utility.internal.SimpleStack;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0;
-import org.eclipse.jpt.jpa.core.jpa2.MetamodelSynchronizer;
-import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-
-import com.ibm.icu.text.DateFormat;
-import com.ibm.icu.text.SimpleDateFormat;
-
-/**
- * For now, the "synchronization" is simple brute-force: we generate the source
- * code and then compare it with what is already present in the file.
- * If the new source is different, we replace the file contents; otherwise, we
- * leave the file unchanged.
- */
-@SuppressWarnings("nls")
-public class GenericMetamodelSynchronizer
- implements MetamodelSourceType.Synchronizer
-{
- protected final MetamodelSourceType sourceType;
-
-
- public GenericMetamodelSynchronizer(MetamodelSourceType sourceType) {
- super();
- this.sourceType = sourceType;
- }
-
- public IFile getFile() {
- return (IFile) this.getPackageFragment().getCompilationUnit(this.getFileName()).getResource();
- }
-
-
- // ********** synchronize **********
-
- public void synchronize(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- try {
- this.synchronize_(memberTypeTree);
- } catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- }
- }
-
- protected void synchronize_(Map<String, Collection<MetamodelSourceType>> memberTypeTree) throws JavaModelException {
- IPackageFragment pkg = this.getPackageFragment();
- String fileName = this.getFileName();
-
- ICompilationUnit compilationUnit = pkg.getCompilationUnit(fileName);
- if (compilationUnit.exists()) {
- // overwrite existing file if it has changed (ignoring the timestamp)
- String newSource = this.buildSource(compilationUnit, memberTypeTree);
- if (newSource != null) {
- pkg.createCompilationUnit(fileName, newSource, true, null); // true=force
- }
- } else {
- // write a new file, creating the package folders if necessary
- if ( ! pkg.exists()) {
- this.getSourceFolder().createPackageFragment(pkg.getElementName(), true, null); // true=force
- }
- pkg.createCompilationUnit(fileName, this.buildSource(memberTypeTree), false, null); // false=no force
- }
- }
-
- /**
- * pre-condition: the compilation unit exists
- *
- * return null if the old source is not to be replaced
- */
- protected String buildSource(ICompilationUnit compilationUnit, Map<String, Collection<MetamodelSourceType>> memberTypeTree) throws JavaModelException {
- IFile file = (IFile) compilationUnit.getResource();
- JavaResourceAbstractType 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 = ((GeneratedAnnotation) genType.getAnnotation(GeneratedAnnotation.ANNOTATION_NAME)).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(MetamodelSynchronizer.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 (ReadOnlyPersistentAttribute att : this.sourceType.getAttributes()) {
- this.printAttributeOn(att, pw);
- printed = true;
- }
- return printed;
- }
-
- protected void printAttributeOn(ReadOnlyPersistentAttribute persistentAttribute, BodySourceWriter pw) {
- AttributeMapping attributeMapping = persistentAttribute.getMapping();
- if (attributeMapping != null) { // probably shouldn't be null?
- this.printAttributeMappingOn(attributeMapping, pw);
- }
- }
-
- protected void printAttributeMappingOn(AttributeMapping attributeMapping, BodySourceWriter pw) {
- MetamodelField field = ((AttributeMapping2_0) attributeMapping).getMetamodelField();
- if (field != null) {
- this.printFieldOn(field, pw);
- }
- }
-
- protected void printFieldOn(MetamodelField field, BodySourceWriter pw) {
- for (String modifier : field.getModifiers()) {
- pw.print(modifier);
- pw.print(' ');
- }
- pw.printTypeDeclaration(field.getTypeName());
- pw.print('<');
- for (Iterator<String> stream = field.getTypeArgumentNames().iterator(); stream.hasNext(); ) {
- pw.printTypeDeclaration(stream.next());
- if (stream.hasNext()) {
- pw.print(", ");
- }
- }
- pw.print('>');
- pw.print(' ');
- pw.print(field.getName());
- pw.print(';');
- pw.println();
- }
-
-
- // ********** member types **********
-
- protected void printMemberTypesOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree, boolean attributesPrinted) {
- Collection<MetamodelSourceType> memberTypes = memberTypeTree.get(this.sourceType.getName());
- if (memberTypes != null) {
- if (attributesPrinted) {
- pw.println();
- }
- for (Iterator<MetamodelSourceType> stream = memberTypes.iterator(); stream.hasNext(); ) {
- stream.next().printBodySourceOn(pw, memberTypeTree);
- if (stream.hasNext()) {
- pw.println();
- }
- }
- }
- }
-
-
- // ********** package and imports **********
-
- protected void printPackageAndImportsOn(PrintWriter pw, BodySourceWriter bodySourceWriter) {
- if (this.getPackageName().length() != 0) {
- pw.print("package ");
- pw.print(this.getPackageName());
- pw.print(';');
- pw.println();
- pw.println();
- }
-
- for (String import_ : bodySourceWriter.getImports()) {
- pw.print("import ");
- pw.print(import_);
- pw.print(';');
- pw.println();
- }
- pw.println();
- }
-
-
- // ********** misc **********
-
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, this.sourceType.getName());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java
deleted file mode 100644
index f3e45023da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java
+++ /dev/null
@@ -1,54 +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.jpa.core.internal.jpa2.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTableValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
-
-public class CollectionTableValidator
- extends AbstractTableValidator
-{
- public CollectionTableValidator(ReadOnlyPersistentAttribute persistentAttribute, CollectionTable2_0 table, TableTextRangeResolver textRangeResolver) {
- super(persistentAttribute, table, textRangeResolver);
- }
-
- @Override
- protected String getUnresolvedCatalogMessage() {
- return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_CATALOG;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedCatalogMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_CATALOG;
- }
-
- @Override
- protected String getUnresolvedSchemaMessage() {
- return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_SCHEMA;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedSchemaMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA;
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java
deleted file mode 100644
index 4714555ae3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java
+++ /dev/null
@@ -1,37 +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.jpa.core.internal.jpa2.context;
-
-import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractNamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0;
-
-public class OrderColumnValidator
- extends AbstractNamedColumnValidator<OrderColumn2_0, NamedColumnTextRangeResolver>
-{
- public OrderColumnValidator(
- ReadOnlyPersistentAttribute persistentAttribute,
- OrderColumn2_0 column,
- NamedColumnTextRangeResolver textRangeResolver) {
- super(persistentAttribute, column, textRangeResolver);
- }
-
- @Override
- protected String getUnresolvedNameMessage() {
- return JpaValidationMessages.ORDER_COLUMN_UNRESOLVED_NAME;
- }
-
- @Override
- protected String getVirtualAttributeUnresolvedNameMessage() {
- return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java
deleted file mode 100644
index 7720bfbd30..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context;
-
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-
-/**
- * Straightforward implementation.
- */
-public class SimpleMetamodelField
- implements MetamodelField
-{
- protected final Iterable<String> modifiers;
- protected final String typeName;
- protected final Iterable<String> typeArgumentNames;
- protected final String name;
-
- public SimpleMetamodelField(
- Iterable<String> modifiers,
- String typeName,
- Iterable<String> typeArgumentNames,
- String name
- ) {
- super();
- if (modifiers == null) {
- throw new NullPointerException();
- }
- if (typeName == null) {
- throw new NullPointerException();
- }
- if (typeArgumentNames == null) {
- throw new NullPointerException();
- }
- if (name == null) {
- throw new NullPointerException();
- }
- this.modifiers = modifiers;
- this.typeName = typeName;
- this.typeArgumentNames = typeArgumentNames;
- this.name = name;
- }
-
- public Iterable<String> getModifiers() {
- return this.modifiers;
- }
-
- public String getTypeName() {
- return this.typeName;
- }
-
- public Iterable<String> getTypeArgumentNames() {
- return this.typeArgumentNames;
- }
-
- public String getName() {
- return this.name;
- }
-
- @Override
- public int hashCode() {
- return CollectionTools.hashCode(this.modifiers) ^
- this.typeName.hashCode() ^
- CollectionTools.hashCode(this.typeArgumentNames) ^
- this.name.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- if ( ! (o instanceof MetamodelField)) {
- return false;
- }
- MetamodelField other = (MetamodelField) o;
- return CollectionTools.elementsAreEqual(this.getModifiers(), other.getModifiers()) &&
- this.getTypeName().equals(other.getTypeName()) &&
- CollectionTools.elementsAreEqual(this.getTypeArgumentNames(), other.getTypeArgumentNames()) &&
- this.getName().equals(other.getName());
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- for (String modifier : this.modifiers) {
- sb.append(modifier);
- sb.append(' ');
- }
- sb.append(this.typeName);
- sb.append('<');
- for (String typeArgumentName : this.typeArgumentNames) {
- sb.append(typeArgumentName);
- sb.append(", "); //$NON-NLS-1$
- }
- sb.setLength(sb.length() - 2);
- sb.append('>');
- sb.append(' ');
- sb.append(this.name);
- return sb.toString();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
deleted file mode 100644
index 2f0edb9941..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
+++ /dev/null
@@ -1,1560 +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.jpa.core.internal.jpa2.context.java;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.JDTTools;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceMember;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.Association;
-import org.eclipse.jpt.common.utility.internal.SimpleAssociation;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.context.AssociationOverride;
-import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.AttributeOverride;
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.CollectionTableValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * JPA 2.0 Frankenstein mapping
- */
-public abstract class AbstractJavaElementCollectionMapping2_0
- extends AbstractJavaAttributeMapping<ElementCollection2_0Annotation>
- implements JavaElementCollectionMapping2_0
-{
- protected String specifiedTargetClass;
- protected String defaultTargetClass;
- protected String fullyQualifiedTargetClass;
-
- protected FetchType specifiedFetch;
- protected FetchType defaultFetch;
-
- protected final JavaOrderable2_0 orderable;
-
- protected final JavaCollectionTable2_0 collectionTable;
-
- protected Type valueType;
- protected final JavaColumn valueColumn;
- protected JavaConverter converter; // value converter - never null
- protected final JavaAttributeOverrideContainer valueAttributeOverrideContainer;
- protected final JavaAssociationOverrideContainer valueAssociationOverrideContainer;
-
- protected Type keyType;
-
- //MapKey is not supported by the spec, so this is only for EclipseLink
- //In the generic case we can handle this with validation and not showing the UI widgets
- protected String specifiedMapKey;
- protected boolean noMapKey = false;
- protected boolean pkMapKey = false;
- protected boolean customMapKey = false;
-
- protected String specifiedMapKeyClass;
- protected String defaultMapKeyClass;
- protected String fullyQualifiedMapKeyClass;
-
- protected final JavaColumn mapKeyColumn;
-
- protected final JavaAttributeOverrideContainer mapKeyAttributeOverrideContainer;
-
-
- protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] {
- JavaEnumeratedConverter.Adapter.instance(),
- JavaTemporalConverter.Adapter.instance(),
- JavaLobConverter.Adapter.instance()
- };
- protected static final Iterable<JavaConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<JavaConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
-
-
- protected AbstractJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
- super(parent);
- this.specifiedTargetClass = this.buildSpecifiedTargetClass();
- this.specifiedFetch = this.buildSpecifiedFetch();
- this.orderable = this.buildOrderable();
- this.collectionTable = this.buildCollectionTable();
-
- this.valueColumn = this.buildValueColumn();
- this.converter = this.buildConverter();
- this.valueAttributeOverrideContainer = this.buildValueAttributeOverrideContainer();
- this.valueAssociationOverrideContainer = this.buildValueAssociationOverrideContainer();
-
- this.specifiedMapKey = this.buildSpecifiedMapKey();
- this.noMapKey = this.buildNoMapKey();
- this.pkMapKey = this.buildPkMapKey();
- this.customMapKey = this.buildCustomMapKey();
- this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass();
-
- this.mapKeyColumn = this.buildMapKeyColumn();
- this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedTargetClass_(this.buildSpecifiedTargetClass());
- this.setSpecifiedFetch_(this.buildSpecifiedFetch());
- this.orderable.synchronizeWithResourceModel();
- this.collectionTable.synchronizeWithResourceModel();
-
- this.valueColumn.synchronizeWithResourceModel();
- this.syncConverter();
- this.valueAttributeOverrideContainer.synchronizeWithResourceModel();
- this.valueAssociationOverrideContainer.synchronizeWithResourceModel();
-
- this.setSpecifiedMapKey_(this.buildSpecifiedMapKey());
- this.setNoMapKey_(this.buildNoMapKey());
- this.setPkMapKey_(this.buildPkMapKey());
- this.setCustomMapKey_(this.buildCustomMapKey());
- this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass());
-
- this.mapKeyColumn.synchronizeWithResourceModel();
- this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
-
- this.setDefaultTargetClass(this.buildDefaultTargetClass());
- this.setFullyQualifiedTargetClass(this.buildFullyQualifiedTargetClass());
- this.setDefaultFetch(this.buildDefaultFetch());
-
- this.orderable.update();
- this.collectionTable.update();
-
- this.setValueType(this.buildValueType());
- this.valueColumn.update();
- this.converter.update();
- this.valueAttributeOverrideContainer.update();
- this.valueAssociationOverrideContainer.update();
-
- this.setKeyType(this.buildKeyType());
- this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
- this.setFullyQualifiedMapKeyClass(this.buildFullyQualifiedMapKeyClass());
-
- this.mapKeyColumn.update();
- this.mapKeyAttributeOverrideContainer.update();
- }
-
-
- // ********** target class **********
-
- public String getTargetClass() {
- return (this.specifiedTargetClass != null) ? this.specifiedTargetClass : this.defaultTargetClass;
- }
-
- public String getSpecifiedTargetClass() {
- return this.specifiedTargetClass;
- }
-
- public void setSpecifiedTargetClass(String targetClass) {
- if (this.valuesAreDifferent(targetClass, this.specifiedTargetClass)) {
- this.getAnnotationForUpdate().setTargetClass(targetClass);
- this.setSpecifiedTargetClass_(targetClass);
- }
- }
-
- protected void setSpecifiedTargetClass_(String targetClass) {
- String old = this.specifiedTargetClass;
- this.specifiedTargetClass = targetClass;
- this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, targetClass);
- }
-
- protected String buildSpecifiedTargetClass() {
- ElementCollection2_0Annotation annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getTargetClass();
- }
-
- public String getDefaultTargetClass() {
- return this.defaultTargetClass;
- }
-
- protected void setDefaultTargetClass(String targetClass) {
- String old = this.defaultTargetClass;
- this.defaultTargetClass = targetClass;
- this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, targetClass);
- }
-
- protected String buildDefaultTargetClass() {
- return this.getPersistentAttribute().getMultiReferenceTargetTypeName();
- }
-
- public String getFullyQualifiedTargetClass() {
- return this.fullyQualifiedTargetClass;
- }
-
- protected void setFullyQualifiedTargetClass(String targetClass) {
- String old = this.fullyQualifiedTargetClass;
- this.fullyQualifiedTargetClass = targetClass;
- this.firePropertyChanged(FULLY_QUALIFIED_TARGET_CLASS_PROPERTY, old, targetClass);
- }
-
- protected String buildFullyQualifiedTargetClass() {
- return (this.specifiedTargetClass == null) ?
- this.defaultTargetClass :
- this.getMappingAnnotation().getFullyQualifiedTargetClassName();
- }
-
- public char getTargetClassEnclosingTypeSeparator() {
- return '.';
- }
-
-
- // ********** resolved target type/embeddable/entity **********
-
- public PersistentType getResolvedTargetType() {
- return this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTargetClass);
- }
-
- protected Embeddable getResolvedTargetEmbeddable() {
- return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedTargetClass);
- }
-
- protected Entity getResolvedTargetEntity() {
- return this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetClass);
- }
-
-
- // ********** fetch **********
-
- public FetchType getFetch() {
- return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType fetch) {
- if (this.valuesAreDifferent(fetch, this.specifiedFetch)) {
- this.getAnnotationForUpdate().setFetch(FetchType.toJavaResourceModel(fetch));
- this.setSpecifiedFetch_(fetch);
- }
- }
-
- protected void setSpecifiedFetch_(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType buildSpecifiedFetch() {
- ElementCollection2_0Annotation annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : FetchType.fromJavaResourceModel(annotation.getFetch());
- }
-
- public FetchType getDefaultFetch() {
- return this.defaultFetch;
- }
-
- protected void setDefaultFetch(FetchType fetch) {
- FetchType old = this.defaultFetch;
- this.defaultFetch = fetch;
- this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType buildDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
-
- // ********** orderable **********
-
- public JavaOrderable2_0 getOrderable() {
- return this.orderable;
- }
-
- protected JavaOrderable2_0 buildOrderable() {
- return this.getJpaFactory().buildJavaOrderable(this, this.buildOrderableOwner());
- }
-
- protected Orderable2_0.Owner buildOrderableOwner() {
- return new OrderableOwner();
- }
-
- protected class OrderableOwner
- implements Orderable2_0.Owner
- {
- public String getTableName() {
- return this.getCollectionTable().getName();
- }
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return this.getCollectionTable().getDbTable();
- }
- protected JavaCollectionTable2_0 getCollectionTable() {
- return AbstractJavaElementCollectionMapping2_0.this.getCollectionTable();
- }
- }
-
-
- // ********** collection table **********
-
- public JavaCollectionTable2_0 getCollectionTable() {
- return this.collectionTable;
- }
-
- protected JavaCollectionTable2_0 buildCollectionTable() {
- return this.getJpaFactory().buildJavaCollectionTable(this, this.buildCollectionTableOwner());
- }
-
- protected Table.Owner buildCollectionTableOwner() {
- return new CollectionTableOwner();
- }
-
- protected class CollectionTableOwner
- implements ReadOnlyTable.Owner
- {
- public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return new CollectionTableValidator(AbstractJavaElementCollectionMapping2_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.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.getResourceAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeValueColumnAnnotation() {
- this.getResourceAttribute().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) {
- JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
- 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() {
- JavaResourceAttribute resourceAttribute = this.getResourceAttribute();
- 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 JavaAssociationOverrideContainer2_0.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.getResourceAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- }
-
- protected MapKeyAnnotation getMapKeyAnnotationForUpdate() {
- MapKeyAnnotation annotation = this.getMapKeyAnnotation();
- return (annotation != null ) ? annotation : this.addMapKeyAnnotation();
- }
-
- protected MapKeyAnnotation addMapKeyAnnotation() {
- return (MapKeyAnnotation) this.getResourceAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME);
- }
-
- protected void removeMapKeyAnnotation() {
- this.getResourceAttribute().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.getResourceAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
- }
-
- protected MapKeyClass2_0Annotation addMapKeyClassAnnotation() {
- return (MapKeyClass2_0Annotation) this.getResourceAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME);
- }
-
- protected void removeMapKeyClassAnnotation() {
- this.getResourceAttribute().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.getResourceAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME);
- }
-
- protected void removeMapKeyColumnAnnotation() {
- this.getResourceAttribute().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 Iterable<String> getCandidateMapKeyNames() {
- return this.getAllTargetEmbeddableAttributeNames();
- }
-
- protected Iterable<String> getAllTargetEmbeddableAttributeNames() {
- return new CompositeIterable<String>(this.getAllTargetEmbeddableAttributeNamesLists());
- }
-
- /**
- * 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 Iterable<Iterable<String>> getAllTargetEmbeddableAttributeNamesLists() {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getAllTargetEmbeddableAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<AttributeMapping> getAllTargetEmbeddableAttributeMappings() {
- Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
- return (targetEmbeddable != null) ? targetEmbeddable.getAllAttributeMappings() : EmptyIterable.<AttributeMapping> instance();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Iterable<String> getAllMappingNames() {
- return new CompositeIterable<String>(super.getAllMappingNames(), this.getAllEmbeddableAttributeMappingNames());
- }
-
- protected Iterable<String> getAllEmbeddableAttributeMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
- }
-
- @Override
- public Iterable<String> getAllOverridableAttributeMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
- }
-
- @Override
- public Iterable<String> getAllOverridableAssociationMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<String> getQualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<String, String>(this.getEmbeddableOverridableMappingNames(transformer), this.buildQualifierTransformer());
- }
-
- protected Iterable<String> getEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new CompositeIterable<String>(this.getEmbeddableOverridableMappingNamesLists(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 Iterable<Iterable<String>> getEmbeddableOverridableMappingNamesLists(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getEmbeddableAttributeMappings(), 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 : this.getEmbeddableAttributeMappings()) {
- resolvedMapping = mapping.resolveAttributeMapping(attributeName);
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- }
- return null;
- }
-
- protected Iterable<AttributeMapping> getEmbeddableAttributeMappings() {
- Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
- return ((targetEmbeddable != null) && (targetEmbeddable != this.getTypeMapping())) ?
- targetEmbeddable.getAttributeMappings() :
- EmptyIterable.<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
- public JavaPersistentAttribute2_0 getParent() {
- return (JavaPersistentAttribute2_0) super.getParent();
- }
-
- @Override
- public JavaPersistentAttribute2_0 getPersistentAttribute() {
- return (JavaPersistentAttribute2_0) super.getPersistentAttribute();
- }
-
- @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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.collectionTable.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.valueColumn.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.converter.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.orderable.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.valueAttributeOverrideContainer.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.valueAssociationOverrideContainer.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.mapKeyNameTouches(pos, astRoot)) {
- return this.getJavaCandidateMapKeyNames(filter);
- }
- result = this.mapKeyColumn.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- result = this.mapKeyAttributeOverrideContainer.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- return null;
- }
-
- protected Iterable<String> getJavaCandidateMapKeyNames(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(this.getCandidateMapKeyNames(filter));
- }
-
- protected Iterable<String> getCandidateMapKeyNames(Filter<String> filter) {
- return new FilteringIterable<String>(this.getCandidateMapKeyNames(), filter);
- }
-
-
- // ********** metamodel **********
-
- @Override
- protected String getMetamodelFieldTypeName() {
- return 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 = 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) {
- String targetClass = this.getFullyQualifiedTargetClass();
- if (StringTools.stringIsEmpty(targetClass)) {
- if (this.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- }
- return;
- }
-
- IJavaProject javaProject = this.getJpaProject().getJavaProject();
- if (JDTTools.findType(javaProject, targetClass) != null) {
- if ( ! JDTTools.typeIsBasic(javaProject, targetClass) && (this.getResolvedTargetEmbeddable() == null)) {
- if (this.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE,
- new String[] {this.getName(), this.getTargetClass()},
- this,
- this.getTargetClassTextRange(astRoot)
- )
- );
- } else {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE,
- new String[] {this.getTargetClass(), this.getName()},
- this,
- this.getTargetClassTextRange(astRoot)
- )
- );
- }
- }
- }
- }
-
- protected TextRange getTargetClassTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(this.getAnnotationTargetClassTextRange(astRoot), astRoot);
- }
-
- protected TextRange getAnnotationTargetClassTextRange(CompilationUnit astRoot) {
- ElementCollection2_0Annotation annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getTargetClassTextRange(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) {
- if (this.getPersistentAttribute().isVirtual()) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange(astRoot)
- )
- );
- } else {
- 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) {
- this.converter.validate(messages, reporter, 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);
- 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 JavaResourceMember getResourceMember() {
- return AbstractJavaElementCollectionMapping2_0.this.getResourceAttribute();
- }
-
- public TypeMapping getTypeMapping() {
- return AbstractJavaElementCollectionMapping2_0.this.getTypeMapping();
- }
-
- public String getDefaultTableName() {
- return this.getCollectionTable().getName();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- JavaCollectionTable2_0 table = this.getCollectionTable();
- return Tools.valuesAreEqual(table.getName(), tableName) ? table.getDbTable() : null;
- }
-
- public Iterable<String> getCandidateTableNames() {
- return EmptyIterable.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();
- }
-
- protected JavaPersistentAttribute2_0 getPersistentAttribute() {
- return AbstractJavaElementCollectionMapping2_0.this.getPersistentAttribute();
- }
- }
-
-
- // ********** 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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) 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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new MapKeyColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) 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_);
- }
- }
-
-
- // ********** value attribute override container owner **********
-
- protected class ValueAttributeOverrideContainerOwner
- extends ValueOverrideContainerOwner
- implements JavaAttributeOverrideContainer2_0.Owner
- {
- public Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? overriddenTypeMapping.getAllOverridableAttributeNames() : EmptyIterable.<String>instance();
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AttributeOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
- }
- }
-
-
- // ********** value association override container owner **********
-
- protected class ValueAssociationOverrideContainerOwner
- extends ValueOverrideContainerOwner
- implements JavaAssociationOverrideContainer2_0.Owner
- {
- public Iterable<String> getAllOverridableNames() {
- TypeMapping typeMapping = this.getOverridableTypeMapping();
- return (typeMapping != null) ? typeMapping.getAllOverridableAssociationNames() : EmptyIterable.<String>instance();
- }
-
- public Relationship resolveOverriddenRelationship(String attributeName) {
- return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AssociationOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyAssociationOverride) override, (ReadOnlyJoinColumn) column, (ReadOnlyJoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- throw this.buildJoinTableUnsupportedException();
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- throw this.buildJoinTableUnsupportedException();
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- throw this.buildJoinTableUnsupportedException();
- }
-
- protected UnsupportedOperationException buildJoinTableUnsupportedException() {
- return new UnsupportedOperationException("An element collection containing a nested relationship mapping using a join table is not supported"); //$NON-NLS-1$
- }
- }
-
-
- // ********** map key attribute override container owner **********
-
- protected class MapKeyAttributeOverrideContainerOwner
- extends AbstractOwner
- implements JavaAttributeOverrideContainer2_0.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 Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? overriddenTypeMapping.getAllOverridableAttributeNames() : EmptyIterable.<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 buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
deleted file mode 100644
index 5b8595bab7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java
+++ /dev/null
@@ -1,170 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
-
-/**
- * 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.getJavaResourceType().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.getJavaResourceType().addAnnotation(this.getCacheableAnnotationName());
- }
-
- protected void removeCacheableAnnotation() {
- this.getJavaResourceType().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 JavaResourceType getJavaResourceType() {
- return this.getCacheableHolder().getJavaResourceType();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getCacheableHolder().getValidationTextRange(astRoot);
- }
-
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- Cacheable2_0Annotation annotation = this.getCacheableAnnotation();
- return (annotation == null) ? null : annotation.getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java
deleted file mode 100644
index aa6c20a7fe..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaReferenceTable;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
-
-/**
- * Java collection table
- */
-public class GenericJavaCollectionTable2_0
- extends GenericJavaReferenceTable<CollectionTable2_0Annotation>
- implements JavaCollectionTable2_0
-{
- public GenericJavaCollectionTable2_0(JavaElementCollectionMapping2_0 parent, Owner owner) {
- super(parent, owner);
- }
-
- @Override
- protected JavaReadOnlyJoinColumn.Owner buildJoinColumnOwner() {
- return new JoinColumnOwner();
- }
-
-
- // ********** table annotation **********
-
- @Override
- public CollectionTable2_0Annotation getTableAnnotation() {
- return (CollectionTable2_0Annotation) this.getElementCollectionMapping().getResourceAttribute().getNonNullAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME);
- }
-
- @Override
- protected void removeTableAnnotation() {
- this.getElementCollectionMapping().getResourceAttribute().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 JavaReadOnlyJoinColumn.Owner
- {
- protected JoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getTypeMapping();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return Tools.valuesAreEqual(GenericJavaCollectionTable2_0.this.getName(), tableName) ?
- GenericJavaCollectionTable2_0.this.getDbTable() :
- null;
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- /**
- * by default, the join column is, obviously, in the collection table;
- * not sure whether it can be anywhere else...
- */
- public String getDefaultTableName() {
- return GenericJavaCollectionTable2_0.this.getName();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return GenericJavaCollectionTable2_0.this.getValidationTextRange(astRoot);
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericJavaCollectionTable2_0.this.getDefaultJoinColumn() == joinColumn;
- }
-
- /**
- * If there is a specified table name it needs to be the same
- * the default table name. The table is always the collection table.
- */
- public boolean tableNameIsInvalid(String tableName) {
- return ! StringTools.stringsAreEqual(this.getDefaultTableName(), tableName);
- }
-
- /**
- * the join column can only be on the collection table itself
- */
- public Iterable<String> getCandidateTableNames() {
- return EmptyIterable.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();
- }
-
- protected PersistentAttribute getPersistentAttribute() {
- return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getPersistentAttribute();
- }
-
- public int getJoinColumnsSize() {
- return GenericJavaCollectionTable2_0.this.getJoinColumnsSize();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new JoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
deleted file mode 100644
index 6050364ba3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java
+++ /dev/null
@@ -1,188 +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.jpa.core.internal.jpa2.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaDerivedIdentity2_0
- extends AbstractJavaJpaContextNode
- implements JavaDerivedIdentity2_0
-{
- /** this can be <code>null</code> */
- 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();
- }
-
-
- // ********** 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 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 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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.strategy != null) {
- result = ((JavaJpaContextNode) this.strategy).getJavaCompletionProposals(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.strategy != null) {
- ((JavaJpaContextNode) this.strategy).validate(messages, reporter, astRoot);
- }
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getMapping().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java
deleted file mode 100644
index acaed18545..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-
-public class GenericJavaElementCollectionMapping2_0
- extends AbstractJavaElementCollectionMapping2_0
-{
- public GenericJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) {
- super(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java
deleted file mode 100644
index 2635174885..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddable;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-
-/**
- * JPA 2.0
- * Java embeddable type mapping
- */
-public class GenericJavaEmbeddable2_0
- extends AbstractJavaEmbeddable
-{
- public GenericJavaEmbeddable2_0(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) {
- super(parent, mappingAnnotation);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return ArrayTools.contains(ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-
- public static final String[] ALLOWED_ATTRIBUTE_MAPPING_KEYS =
- new String[] {
- MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY,
- MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY,
- MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
deleted file mode 100644
index bdd4cd8ed6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java
+++ /dev/null
@@ -1,142 +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.jpa.core.internal.jpa2.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-import org.eclipse.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 JavaResourceAttribute getResourceAttribute() {
- return this.getMapping().getPersistentAttribute().getResourceAttribute();
- }
-
- 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) {
- TextRange textRange = this.getAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getDerivedIdentity().getValidationTextRange(astRoot);
- }
-
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- IdAnnotation annotation = this.getAnnotation();
- return (annotation == null) ? null : annotation.getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
deleted file mode 100644
index 77283f7102..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java
+++ /dev/null
@@ -1,370 +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.jpa.core.internal.jpa2.context.java;
-
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.Filter;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.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 specifiedIdAttributeName;
- protected String defaultIdAttributeName;
-
-
- public GenericJavaMapsIdDerivedIdentityStrategy2_0(JavaDerivedIdentity2_0 parent) {
- super(parent);
- this.specifiedIdAttributeName = this.buildSpecifiedIdAttributeName();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedIdAttributeName_(this.buildSpecifiedIdAttributeName());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultIdAttributeName(this.buildDefaultIdAttributeName());
- }
-
-
- // ********** ID attribute name **********
-
- public String getIdAttributeName() {
- return (this.specifiedIdAttributeName != null) ? this.specifiedIdAttributeName : this.defaultIdAttributeName;
- }
-
- public String getSpecifiedIdAttributeName() {
- return this.specifiedIdAttributeName;
- }
-
- public void setSpecifiedIdAttributeName(String idAttributeName) {
- if (this.valuesAreDifferent(idAttributeName, this.specifiedIdAttributeName)) {
- this.getAnnotation().setValue(idAttributeName);
- this.setSpecifiedIdAttributeName_(idAttributeName);
- }
- }
-
- protected void setSpecifiedIdAttributeName_(String idAttributeName) {
- String old = this.specifiedIdAttributeName;
- this.specifiedIdAttributeName = idAttributeName;
- this.firePropertyChanged(SPECIFIED_ID_ATTRIBUTE_NAME_PROPERTY, old, idAttributeName);
- }
-
- protected String buildSpecifiedIdAttributeName() {
- return this.getAnnotation().getValue();
- }
-
- public String getDefaultIdAttributeName() {
- return this.defaultIdAttributeName;
- }
-
- protected void setDefaultIdAttributeName(String idAttributeName) {
- String old = this.defaultIdAttributeName;
- this.defaultIdAttributeName = idAttributeName;
- this.firePropertyChanged(DEFAULT_ID_ATTRIBUTE_NAME_PROPERTY, old, idAttributeName);
- }
-
- protected String buildDefaultIdAttributeName() {
- 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 defaultIdAttributeNameIsPossible() {
- 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 JavaResourceAttribute getResourceAttribute() {
- return this.getPersistentAttribute().getResourceAttribute();
- }
-
- protected Iterable<AttributeMapping> getAllAttributeMappings() {
- return CollectionTools.collection(this.getPersistentAttribute().getOwningTypeMapping().getAllAttributeMappings());
- }
-
- public Iterable<String> getSortedCandidateIdAttributeNames() {
- 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.getAllAttributeMappings())
- );
- }
-
- public AttributeMapping getDerivedIdAttributeMapping() {
- String idAttributeName = this.getIdAttributeName();
- if (idAttributeName != null) {
- for (AttributeMapping mapping : this.getAllAttributeMappingChoices()) {
- if (idAttributeName.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 Iterable<String> getJavaCompletionProposals(int pos, Filter<String> filter, CompilationUnit astRoot) {
- Iterable<String> result = super.getJavaCompletionProposals(pos, filter, astRoot);
- if (result != null) {
- return result;
- }
- if (this.getAnnotation().valueTouches(pos, astRoot)) {
- result = this.getSortedJavaValueChoices(filter);
- }
- return result;
- }
-
- protected Iterable<String> getSortedJavaValueChoices(Filter<String> filter) {
- return StringTools.convertToJavaStringLiterals(new FilteringIterable<String>(this.getSortedCandidateIdAttributeNames(), 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 id attribute name can be resolved
- AttributeMapping attributeMapping = this.getDerivedIdAttributeMapping();
- if (attributeMapping == null) {
- // if id attribute name is not specified, use that message
- if (this.specifiedIdAttributeName == 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.getIdAttributeName()}, 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.getIdAttributeName()}, astRoot));
- }
- }
- }
-
- protected Iterable<AttributeMapping> getValidAttributeMappingChoices() {
- return this.buildAttributeMappingChoices(this.getIdAttributeMappings());
- }
-
- protected IMessage buildMessage(String msgID, String[] parms, CompilationUnit astRoot) {
- 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(astRoot)
- );
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getDerivedIdentity().getValidationTextRange(astRoot);
- }
-
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- return this.getAnnotation().getTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
deleted file mode 100644
index 0d1255aeb4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java
+++ /dev/null
@@ -1,103 +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.jpa.core.internal.jpa2.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
-import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaNamedQuery2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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;
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateQuery_(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
- helper.validate(this, this.query, this.getQueryAnnotation().getQueryTextRange(astRoot), 1, messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
deleted file mode 100644
index 586c676820..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java
+++ /dev/null
@@ -1,250 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-
-/**
- * Java order column
- */
-public class GenericJavaOrderColumn2_0
- extends AbstractJavaNamedColumn<OrderColumn2_0Annotation, JavaReadOnlyNamedColumn.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, JavaReadOnlyNamedColumn.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.getResourceAttribute().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.getResourceAttribute());
- }
-
- @Override
- protected void removeColumnAnnotation() {
- if (this.isJpa2_0Compatible()) {
- this.getResourceAttribute().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 JavaResourceAttribute getResourceAttribute() {
- return this.getOrderable().getResourceAttribute();
- }
-
- @Override
- public String getTable() {
- return this.getOrderable().getDefaultTableName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java
deleted file mode 100644
index 60ddabad13..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java
+++ /dev/null
@@ -1,126 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OwningRelationshipMapping2_0Annotation;
-
-/**
- * Java orphan removal
- */
-public class GenericJavaOrphanRemoval2_0
- extends AbstractJavaJpaContextNode
- implements JavaOrphanRemovable2_0
-{
- protected Boolean specifiedOrphanRemoval;
- protected boolean defaultOrphanRemoval;
-
-
- public GenericJavaOrphanRemoval2_0(JavaOrphanRemovalHolder2_0 parent) {
- super(parent);
- this.specifiedOrphanRemoval = this.buildSpecifiedOrphanRemoval();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedOrphanRemoval_(this.buildSpecifiedOrphanRemoval());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultOrphanRemoval(this.buildDefaultOrphanRemoval());
- }
-
-
- // ********** orphan removal **********
-
- public boolean isOrphanRemoval() {
- return (this.specifiedOrphanRemoval != null) ? this.specifiedOrphanRemoval.booleanValue() : this.defaultOrphanRemoval;
- }
-
- public Boolean getSpecifiedOrphanRemoval() {
- return this.specifiedOrphanRemoval;
- }
-
- public void setSpecifiedOrphanRemoval(Boolean orphanRemoval) {
- if (this.valuesAreDifferent(orphanRemoval, this.specifiedOrphanRemoval)) {
- this.getMappingAnnotationForUpdate().setOrphanRemoval(orphanRemoval);
- this.setSpecifiedOrphanRemoval_(orphanRemoval);
- }
- }
-
- protected void setSpecifiedOrphanRemoval_(Boolean orphanRemoval) {
- Boolean old = this.specifiedOrphanRemoval;
- this.specifiedOrphanRemoval = orphanRemoval;
- this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
- }
-
- protected Boolean buildSpecifiedOrphanRemoval() {
- OwningRelationshipMapping2_0Annotation annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getOrphanRemoval();
- }
-
- public boolean isDefaultOrphanRemoval() {
- return this.defaultOrphanRemoval;
- }
-
- protected void setDefaultOrphanRemoval(boolean orphanRemoval) {
- boolean old = this.defaultOrphanRemoval;
- this.defaultOrphanRemoval = orphanRemoval;
- this.firePropertyChanged(DEFAULT_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
- }
-
- protected boolean buildDefaultOrphanRemoval() {
- return DEFAULT_ORPHAN_REMOVAL;
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaOrphanRemovalHolder2_0 getParent() {
- return (JavaOrphanRemovalHolder2_0) super.getParent();
- }
-
- protected JavaAttributeMapping getMapping() {
- return (JavaAttributeMapping) this.getParent();
- }
-
- protected OwningRelationshipMapping2_0Annotation getMappingAnnotation() {
- return (OwningRelationshipMapping2_0Annotation) this.getMapping().getMappingAnnotation();
- }
-
- protected OwningRelationshipMapping2_0Annotation getMappingAnnotationForUpdate() {
- return (OwningRelationshipMapping2_0Annotation) this.getMapping().getAnnotationForUpdate();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- TextRange textRange = this.getAnnotationTextRange(astRoot);
- return (textRange != null) ? textRange : this.getMapping().getValidationTextRange(astRoot);
- }
-
- protected TextRange getAnnotationTextRange(CompilationUnit astRoot) {
- OwningRelationshipMapping2_0Annotation annotation = this.getMappingAnnotation();
- return (annotation == null) ? null : annotation.getOrphanRemovalTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java
deleted file mode 100644
index c4a7ab7f72..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideRelationship2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-
-public class GenericJavaOverrideJoinTableRelationshipStrategy2_0
- extends AbstractJavaJoinTableRelationshipStrategy
-{
- public GenericJavaOverrideJoinTableRelationshipStrategy2_0(JavaOverrideRelationship2_0 parent) {
- super(parent);
- }
-
-
- // ********** join table annotation **********
-
- public JoinTableAnnotation getJoinTableAnnotation() {
- return this.getOverrideAnnotation().getNonNullJoinTable();
- }
-
- @Override
- protected JoinTableAnnotation addJoinTableAnnotation() {
- return this.getOverrideAnnotation().addJoinTable();
- }
-
- @Override
- protected void removeJoinTableAnnotation() {
- this.getOverrideAnnotation().removeJoinTable();
- }
-
- protected AssociationOverride2_0Annotation getOverrideAnnotation() {
- // only JPA 2.0 association overrides can have a join table (join strategy)
- return (AssociationOverride2_0Annotation) this.getRelationship().getOverrideAnnotation();
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaOverrideRelationship2_0 getParent() {
- return (JavaOverrideRelationship2_0) super.getParent();
- }
-
- @Override
- public JavaOverrideRelationship2_0 getRelationship() {
- return this.getParent();
- }
-
- 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(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableValidator((ReadOnlyJoinTable) table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java
deleted file mode 100644
index 65f5e159f3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.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.jpa.core.internal.jpa2.context.java;
-
-import java.util.Collection;
-import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
-import org.eclipse.jpt.common.core.utility.BodySourceWriter;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0;
-
-/**
- * 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, JavaResourceType jrt) {
- super(parent, jrt);
- this.declaringTypeName = this.buildDeclaringTypeName();
- this.metamodelSynchronizer = this.buildMetamodelSynchronizer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setDeclaringTypeName(this.buildDeclaringTypeName());
- }
-
-
- // ********** 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.resourceType.getDeclaringTypeName();
- }
-
-
- // ********** metamodel **********
-
- public IFile getMetamodelFile() {
- return this.metamodelSynchronizer.getFile();
- }
-
- public void initializeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
- public boolean isManaged() {
- return true;
- }
-
- public void synchronizeMetamodel(Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- this.metamodelSynchronizer.synchronize(memberTypeTree);
- }
-
- public void printBodySourceOn(BodySourceWriter pw, Map<String, Collection<MetamodelSourceType>> memberTypeTree) {
- this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree);
- }
-
- public void disposeMetamodel() {
- // do nothing - probably shouldn't be called...
- }
-
- protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() {
- return this.getJpaFactory2_0().buildMetamodelSynchronizer(this);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java
deleted file mode 100644
index 8b1e0c2f73..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaSequenceGenerator;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSequenceGenerator2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-
-/**
- * JPA 2.0
- * Java sequence generator
- */
-public class GenericJavaSequenceGenerator2_0
- extends AbstractJavaSequenceGenerator<SequenceGenerator2_0Annotation>
- implements JavaSequenceGenerator2_0
-{
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
-
- public GenericJavaSequenceGenerator2_0(JavaJpaContextNode parent, SequenceGenerator2_0Annotation generatorAnnotation) {
- super(parent, generatorAnnotation);
- this.specifiedCatalog = generatorAnnotation.getCatalog();
- this.specifiedSchema = generatorAnnotation.getSchema();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedCatalog_(this.generatorAnnotation.getCatalog());
- this.setSpecifiedSchema_(this.generatorAnnotation.getSchema());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setDefaultSchema(this.buildDefaultSchema());
- }
-
-
- // ********** catalog **********
-
- @Override
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- this.generatorAnnotation.setCatalog(catalog);
- this.setSpecifiedCatalog_(catalog);
- }
-
- protected void setSpecifiedCatalog_(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
- }
-
- public String getDefaultCatalog() {
- return this.defaultCatalog;
- }
-
- protected void setDefaultCatalog(String catalog) {
- String old = this.defaultCatalog;
- this.defaultCatalog = catalog;
- this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
- }
-
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
-
- // ********** schema **********
-
- @Override
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- this.generatorAnnotation.setSchema(schema);
- this.setSpecifiedSchema_(schema);
- }
-
- protected void setSpecifiedSchema_(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
- }
-
- public String getDefaultSchema() {
- return this.defaultSchema;
- }
-
- protected void setDefaultSchema(String schema) {
- String old = this.defaultSchema;
- this.defaultSchema = schema;
- this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
- }
-
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java
deleted file mode 100644
index 4bdd41b7a4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java
+++ /dev/null
@@ -1,153 +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.jpa.core.internal.jpa2.context.java;
-
-import java.util.List;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable;
-import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaVirtualOverrideRelationship2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0
- extends AbstractJavaJpaContextNode
- implements JavaVirtualJoinTableRelationshipStrategy, ReadOnlyTable.Owner
-{
- protected JavaVirtualJoinTable joinTable;
-
-
- public GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0(JavaVirtualOverrideRelationship2_0 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() {
- ReadOnlyJoinTable 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 ReadOnlyJoinTable getOverriddenJoinTable() {
- ReadOnlyJoinTableRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
- return (overriddenStrategy == null) ? null : overriddenStrategy.getJoinTable();
- }
-
- protected JavaVirtualJoinTable buildJoinTable(ReadOnlyJoinTable overriddenJoinTable) {
- return this.getJpaFactory().buildJavaVirtualJoinTable(this, this, overriddenJoinTable);
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaVirtualOverrideRelationship2_0 getParent() {
- return (JavaVirtualOverrideRelationship2_0) super.getParent();
- }
-
- public JavaVirtualOverrideRelationship2_0 getRelationship() {
- return this.getParent();
- }
-
- protected ReadOnlyJoinTableRelationshipStrategy getOverriddenStrategy() {
- ReadOnlyJoinTableRelationship relationship = this.getOverriddenJoinTableRelationship();
- return (relationship == null) ? null : relationship.getJoinTableStrategy();
- }
-
- protected ReadOnlyJoinTableRelationship getOverriddenJoinTableRelationship() {
- ReadOnlyRelationship relationship = this.resolveOverriddenRelationship();
- return (relationship instanceof ReadOnlyJoinTableRelationship) ? (ReadOnlyJoinTableRelationship) relationship : null;
- }
-
- protected ReadOnlyRelationship resolveOverriddenRelationship() {
- return this.getRelationship().resolveOverriddenRelationship();
- }
-
- public String getTableName() {
- return this.joinTable.getName();
- }
-
- public String getJoinTableDefaultName() {
- return MappingTools.buildJoinTableDefaultName(this.getRelationship());
- }
-
-
- // ********** 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);
- }
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationship().getTypeMapping().validatesAgainstDatabase();
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getRelationship().getValidationTextRange(astRoot);
- }
-
- public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableValidator((ReadOnlyJoinTable) table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaBasicMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaBasicMappingDefinition2_0.java
deleted file mode 100644
index a28fcecd2a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaBasicMappingDefinition2_0.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-
-public class JavaBasicMappingDefinition2_0
- extends DefaultJavaAttributeMappingDefinitionWrapper
-{
- private static final DefaultJavaAttributeMappingDefinition DELEGATE = JavaBasicMappingDefinition.instance();
-
- // singleton
- private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaBasicMappingDefinition2_0();
-
- /**
- * Return the singleton.
- */
- public static DefaultJavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaBasicMappingDefinition2_0() {
- super();
- }
-
- @Override
- protected DefaultJavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
deleted file mode 100644
index 6ce75a03cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java
+++ /dev/null
@@ -1,107 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.jpa.core.JpaFactory;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-
-public class JavaElementCollectionMappingDefinition2_0
- implements JavaAttributeMappingDefinition
-{
- // 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();
- }
-
- 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.getResourceAttribute().getAnnotation(this.getAnnotationName()) != null;
- }
-
- public Iterable<String> getSupportingAnnotationNames() {
- return SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] {
- Access2_0Annotation.ANNOTATION_NAME,
- AssociationOverrideAnnotation.ANNOTATION_NAME,
- JPA.ASSOCIATION_OVERRIDES,
- AttributeOverrideAnnotation.ANNOTATION_NAME,
- JPA.ATTRIBUTE_OVERRIDES,
- 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,
- JPA2_0.MAP_KEY_JOIN_COLUMNS,
- MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
- OrderByAnnotation.ANNOTATION_NAME,
- OrderColumn2_0Annotation.ANNOTATION_NAME,
- TemporalAnnotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY);
-
- public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) {
- return ((JpaFactory2_0) factory).buildJavaElementCollectionMapping2_0(persistentAttribute);
- }
-
- @Override
- public String toString() {
- return this.getClass().getSimpleName();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddableDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddableDefinition2_0.java
deleted file mode 100644
index 4b0f18df5c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddableDefinition2_0.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-
-public class JavaEmbeddableDefinition2_0
- extends JavaTypeMappingDefinitionWrapper
-{
- private static final JavaTypeMappingDefinition DELEGATE = JavaEmbeddableDefinition.instance();
-
- // singleton
- private static final JavaTypeMappingDefinition INSTANCE = new JavaEmbeddableDefinition2_0();
-
- /**
- * Return the singleton.
- */
- public static JavaTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaEmbeddableDefinition2_0() {
- super();
- }
-
- @Override
- protected JavaTypeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedIdMappingDefinition2_0.java
deleted file mode 100644
index 214ca6a5e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedIdMappingDefinition2_0.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-
-public class JavaEmbeddedIdMappingDefinition2_0
- extends JavaAttributeMappingDefinitionWrapper
-{
- private static final JavaAttributeMappingDefinition DELEGATE = JavaEmbeddedIdMappingDefinition.instance();
-
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaEmbeddedIdMappingDefinition2_0();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaEmbeddedIdMappingDefinition2_0() {
- super();
- }
-
- @Override
- protected JavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
deleted file mode 100644
index 13b275d511..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java
+++ /dev/null
@@ -1,66 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.DefaultJavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-public class JavaEmbeddedMappingDefinition2_0
- extends DefaultJavaAttributeMappingDefinitionWrapper
-{
- private static final DefaultJavaAttributeMappingDefinition DELEGATE = JavaEmbeddedMappingDefinition.instance();
-
- // 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
- protected DefaultJavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME,
- AssociationOverrideAnnotation.ANNOTATION_NAME,
- JPA.ASSOCIATION_OVERRIDES,
- };
- public static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEntityDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEntityDefinition2_0.java
deleted file mode 100644
index 826c03abd1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEntityDefinition2_0.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-
-public class JavaEntityDefinition2_0
- extends JavaTypeMappingDefinitionWrapper
-{
- private static final JavaTypeMappingDefinition DELEGATE = JavaEntityDefinition.instance();
-
- // singleton
- private static final JavaTypeMappingDefinition INSTANCE = new JavaEntityDefinition2_0();
-
- /**
- * Return the singleton.
- */
- public static JavaTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaEntityDefinition2_0() {
- super();
- }
-
- @Override
- protected JavaTypeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java
deleted file mode 100644
index 9ec4396688..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java
+++ /dev/null
@@ -1,100 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-
-/**
- * JPA 2.0 Id mapping
- */
-public class JavaIdMappingDefinition2_0
- extends JavaAttributeMappingDefinitionWrapper
-{
- private static final JavaAttributeMappingDefinition DELEGATE = JavaIdMappingDefinition.instance();
-
- // 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();
- }
-
- @Override
- protected JavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- /**
- * The annotation is "specified" only if it is not "derived" (i.e.
- * accompanied by a M-1 or 1-1 annotation).
- */
- @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>
- */
- private boolean isDerivedId(JavaPersistentAttribute persistentAttribute) {
- return this.attributeHasManyToOneMapping(persistentAttribute) ||
- this.attributeHasOneToOneMapping(persistentAttribute);
- }
-
- private boolean attributeHasManyToOneMapping(JavaPersistentAttribute persistentAttribute) {
- return JavaManyToOneMappingDefinition2_0.instance().isSpecified(persistentAttribute);
- }
-
- private boolean attributeHasOneToOneMapping(JavaPersistentAttribute persistentAttribute) {
- return JavaOneToOneMappingDefinition2_0.instance().isSpecified(persistentAttribute);
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME,
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
deleted file mode 100644
index 6349cfa244..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java
+++ /dev/null
@@ -1,80 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-public class JavaManyToManyMappingDefinition2_0
- extends JavaAttributeMappingDefinitionWrapper
-{
- private static final JavaAttributeMappingDefinition DELEGATE = JavaManyToManyMappingDefinition.instance();
-
- // 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
- protected JavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME,
- AttributeOverrideAnnotation.ANNOTATION_NAME,
- JPA.ATTRIBUTE_OVERRIDES,
- MapKeyClass2_0Annotation.ANNOTATION_NAME,
- MapKeyColumn2_0Annotation.ANNOTATION_NAME,
- MapKeyEnumerated2_0Annotation.ANNOTATION_NAME,
- MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME,
- JPA2_0.MAP_KEY_JOIN_COLUMNS,
- MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
- OrderColumn2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java
deleted file mode 100644
index 18541ac7c8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java
+++ /dev/null
@@ -1,66 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-
-public class JavaManyToOneMappingDefinition2_0
- extends JavaAttributeMappingDefinitionWrapper
-{
- private static final JavaAttributeMappingDefinition DELEGATE = JavaManyToOneMappingDefinition.instance();
-
- // 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
- protected JavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME,
- IdAnnotation.ANNOTATION_NAME,
- MapsId2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaMappedSuperclassDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaMappedSuperclassDefinition2_0.java
deleted file mode 100644
index 550c76293e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaMappedSuperclassDefinition2_0.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaTypeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-
-public class JavaMappedSuperclassDefinition2_0
- extends JavaTypeMappingDefinitionWrapper
-{
- private static final JavaTypeMappingDefinition DELEGATE = JavaMappedSuperclassDefinition.instance();
-
- // singleton
- private static final JavaTypeMappingDefinition INSTANCE = new JavaMappedSuperclassDefinition2_0();
-
- /**
- * Return the singleton.
- */
- public static JavaTypeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaMappedSuperclassDefinition2_0() {
- super();
- }
-
- @Override
- protected JavaTypeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
deleted file mode 100644
index b7e729f7b7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java
+++ /dev/null
@@ -1,80 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-public class JavaOneToManyMappingDefinition2_0
- extends JavaAttributeMappingDefinitionWrapper
-{
- private static final JavaAttributeMappingDefinition DELEGATE = JavaOneToManyMappingDefinition.instance();
-
- // 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
- protected JavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- private static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME,
- AttributeOverrideAnnotation.ANNOTATION_NAME,
- JPA.ATTRIBUTE_OVERRIDES,
- MapKeyClass2_0Annotation.ANNOTATION_NAME,
- MapKeyColumn2_0Annotation.ANNOTATION_NAME,
- MapKeyEnumerated2_0Annotation.ANNOTATION_NAME,
- MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME,
- JPA2_0.MAP_KEY_JOIN_COLUMNS,
- MapKeyTemporal2_0Annotation.ANNOTATION_NAME,
- OrderColumn2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java
deleted file mode 100644
index 6db96e73bb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java
+++ /dev/null
@@ -1,66 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-
-public class JavaOneToOneMappingDefinition2_0
- extends JavaAttributeMappingDefinitionWrapper
-{
- private static final JavaAttributeMappingDefinition DELEGATE = JavaOneToOneMappingDefinition.instance();
-
- // 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
- protected JavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME,
- IdAnnotation.ANNOTATION_NAME,
- MapsId2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaVersionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaVersionMappingDefinition2_0.java
deleted file mode 100644
index 6a87ebd825..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaVersionMappingDefinition2_0.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaAttributeMappingDefinitionWrapper;
-import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-
-public class JavaVersionMappingDefinition2_0
- extends JavaAttributeMappingDefinitionWrapper
-{
- private static final JavaAttributeMappingDefinition DELEGATE = JavaVersionMappingDefinition.instance();
-
- // singleton
- private static final JavaAttributeMappingDefinition INSTANCE = new JavaVersionMappingDefinition2_0();
-
- /**
- * Return the singleton.
- */
- public static JavaAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private JavaVersionMappingDefinition2_0() {
- super();
- }
-
- @Override
- protected JavaAttributeMappingDefinition getDelegate() {
- return DELEGATE;
- }
-
- @Override
- public Iterable<String> getSupportingAnnotationNames() {
- return COMBINED_SUPPORTING_ANNOTATION_NAMES;
- }
-
- public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] {
- Access2_0Annotation.ANNOTATION_NAME
- };
- private static final Iterable<String> SUPPORTING_ANNOTATION_NAMES_2_0 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0);
-
- @SuppressWarnings("unchecked")
- private static final Iterable<String> COMBINED_SUPPORTING_ANNOTATION_NAMES = new CompositeIterable<String>(
- DELEGATE.getSupportingAnnotationNames(),
- SUPPORTING_ANNOTATION_NAMES_2_0
- );
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java
deleted file mode 100644
index cedad0cb21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java
+++ /dev/null
@@ -1,66 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0;
-
-/**
- * null Java cacheable
- */
-public class NullJavaCacheable2_0
- extends AbstractJavaJpaContextNode
- implements JavaCacheable2_0
-{
- public NullJavaCacheable2_0(JavaCacheableHolder2_0 parent) {
- super(parent);
- }
-
-
- // ********** cacheable **********
-
- public boolean isCacheable() {
- return false;
- }
-
- public Boolean getSpecifiedCacheable() {
- return null;
- }
-
- public void setSpecifiedCacheable(Boolean cacheable) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isDefaultCacheable() {
- return false;
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaCacheableHolder2_0 getParent() {
- return (JavaCacheableHolder2_0) super.getParent();
- }
-
- protected JavaCacheableHolder2_0 getCacheableHolder() {
- return this.getParent();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getCacheableHolder().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java
deleted file mode 100644
index c0259aea44..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.java.JavaSingleRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0;
-
-public class NullJavaDerivedIdentity2_0
- extends AbstractJavaJpaContextNode
- implements JavaDerivedIdentity2_0
-{
- public NullJavaDerivedIdentity2_0(JavaSingleRelationshipMapping mapping) {
- super(mapping);
- }
-
-
- // ********** predominant derived identity strategy **********
-
- public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() {
- return null;
- }
-
-
- // ********** null derived identity strategy **********
-
- public boolean usesNullDerivedIdentityStrategy() {
- return true;
- }
-
- public void setNullDerivedIdentityStrategy() {
- // NOP
- }
-
-
- // ********** ID derived identity strategy **********
-
- public JavaIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() {
- return null;
- }
-
- public boolean usesIdDerivedIdentityStrategy() {
- return false;
- }
-
- public void setIdDerivedIdentityStrategy() {
- // NOP
- }
-
-
- // ********** maps ID derived identity strategy **********
-
- public JavaMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() {
- return null;
- }
-
- public boolean usesMapsIdDerivedIdentityStrategy() {
- return false;
- }
-
- public void setMapsIdDerivedIdentityStrategy() {
- // NOP
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaSingleRelationshipMapping getParent() {
- return (JavaSingleRelationshipMapping) super.getParent();
- }
-
- public JavaSingleRelationshipMapping2_0 getMapping() {
- return null;
- }
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getParent().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
deleted file mode 100644
index d3fd955510..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java
+++ /dev/null
@@ -1,275 +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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaColumn;
-import org.eclipse.jpt.jpa.core.context.java.JavaMultiRelationshipMapping;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.db.Table;
-
-/**
- *
- */
-public class NullJavaMapKeyColumn2_0
- extends AbstractJavaJpaContextNode
- implements JavaColumn
-{
- public NullJavaMapKeyColumn2_0(JavaMultiRelationshipMapping parent) {
- super(parent);
- }
-
-
- // ********** column annotation **********
-
- public ColumnAnnotation getColumnAnnotation() {
- return (ColumnAnnotation) this.getParent().getPersistentAttribute().getResourceAttribute().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 Iterable<String> getCandidateTableNames() {
- return EmptyIterable.instance();
- }
-
-
- // ********** database stuff **********
-
- public org.eclipse.jpt.jpa.db.Column getDbColumn() {
- return null;
- }
-
- public Table getDbTable() {
- return null;
- }
-
- public boolean isResolved() {
- return false;
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getParent().getValidationTextRange(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-
- public TextRange getTableTextRange(CompilationUnit astRoot) {
- return this.getValidationTextRange(astRoot);
- }
-
- public boolean tableNameIsInvalid() {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java
deleted file mode 100644
index 200f20541b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_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.jpa.core.internal.jpa2.context.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0;
-
-/**
- * Null Java orphan removal
- */
-public class NullJavaOrphanRemoval2_0
- extends AbstractJavaJpaContextNode
- implements JavaOrphanRemovable2_0
-{
- public NullJavaOrphanRemoval2_0(JavaOrphanRemovalHolder2_0 parent) {
- super(parent);
- }
-
-
- // ********** orphan removal **********
-
- public boolean isOrphanRemoval() {
- return false;
- }
-
- public Boolean getSpecifiedOrphanRemoval() {
- return null;
- }
-
- public boolean isDefaultOrphanRemoval() {
- return false;
- }
-
- public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** misc **********
-
- @Override
- public JavaOrphanRemovalHolder2_0 getParent() {
- return (JavaOrphanRemovalHolder2_0) super.getParent();
- }
-
- // ********** validation **********
-
- public TextRange getValidationTextRange(CompilationUnit astRoot) {
- return this.getParent().getValidationTextRange(astRoot);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
deleted file mode 100644
index a403705e59..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
+++ /dev/null
@@ -1,1526 +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.jpa.core.internal.jpa2.context.orm;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.internal.utility.JDTTools;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.Transformer;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.context.AssociationOverride;
-import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.AttributeOverride;
-import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.Column;
-import org.eclipse.jpt.jpa.core.context.Converter;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.FetchType;
-import org.eclipse.jpt.jpa.core.context.OverrideContainer;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.Relationship;
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmColumn;
-import org.eclipse.jpt.jpa.core.context.orm.OrmConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.CollectionTableValidator;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField;
-import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.Attributes;
-import org.eclipse.jpt.jpa.core.resource.orm.MapKey;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * JPA 2.0 Frankenstein mapping
- */
-public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElementCollection>
- extends AbstractOrmAttributeMapping<X>
- implements OrmElementCollectionMapping2_0
-{
- protected String specifiedTargetClass;
- protected String defaultTargetClass;
-
- protected FetchType specifiedFetch;
- protected FetchType defaultFetch;
-
- protected final OrmOrderable2_0 orderable;
-
- protected final OrmCollectionTable2_0 collectionTable;
-
- protected Type valueType;
- protected final OrmColumn valueColumn;
- protected OrmConverter converter; // value converter - never null
- protected final OrmAttributeOverrideContainer valueAttributeOverrideContainer;
- protected final OrmAssociationOverrideContainer valueAssociationOverrideContainer;
-
- protected Type keyType;
-
- protected String specifiedMapKey;
- protected boolean noMapKey = false;
- protected boolean pkMapKey = false;
- protected boolean customMapKey = false;
-
- protected String specifiedMapKeyClass;
- protected String defaultMapKeyClass;
-
- protected final OrmColumn mapKeyColumn;
-
- protected final OrmAttributeOverrideContainer mapKeyAttributeOverrideContainer;
-
-
- protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] {
- OrmEnumeratedConverter.Adapter.instance(),
- OrmTemporalConverter.Adapter.instance(),
- OrmLobConverter.Adapter.instance()
- };
- protected static final Iterable<OrmConverter.Adapter> CONVERTER_ADAPTERS = new ArrayIterable<OrmConverter.Adapter>(CONVERTER_ADAPTER_ARRAY);
-
-
- protected AbstractOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, X xmlMapping) {
- super(parent, xmlMapping);
- this.specifiedTargetClass = xmlMapping.getTargetClass();
- this.specifiedFetch = this.buildSpecifiedFetch();
- this.orderable = this.buildOrderable();
- this.collectionTable = this.buildCollectionTable();
-
- this.valueColumn = this.buildValueColumn();
- this.converter = this.buildConverter();
- this.valueAttributeOverrideContainer = this.buildValueAttributeOverrideContainer();
- this.valueAssociationOverrideContainer = this.buildValueAssociationOverrideContainer();
-
- this.specifiedMapKey = this.buildSpecifiedMapKey();
- this.noMapKey = this.buildNoMapKey();
- this.pkMapKey = this.buildPkMapKey();
- this.customMapKey = this.buildCustomMapKey();
- this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass();
-
- this.mapKeyColumn = this.buildMapKeyColumn();
- this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedTargetClass_(this.xmlAttributeMapping.getTargetClass());
- this.setSpecifiedFetch_(this.buildSpecifiedFetch());
- this.orderable.synchronizeWithResourceModel();
- this.collectionTable.synchronizeWithResourceModel();
-
- this.valueColumn.synchronizeWithResourceModel();
- this.syncConverter();
- this.valueAttributeOverrideContainer.synchronizeWithResourceModel();
- this.valueAssociationOverrideContainer.synchronizeWithResourceModel();
-
- this.setSpecifiedMapKey_(this.buildSpecifiedMapKey());
- this.setNoMapKey_(this.buildNoMapKey());
- this.setPkMapKey_(this.buildPkMapKey());
- this.setCustomMapKey_(this.buildCustomMapKey());
- this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass());
-
- this.mapKeyColumn.synchronizeWithResourceModel();
- this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel();
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultTargetClass(this.buildDefaultTargetClass());
- this.setDefaultFetch(this.buildDefaultFetch());
- this.orderable.update();
- this.collectionTable.update();
-
- this.setValueType(this.buildValueType());
- this.valueColumn.update();
- this.converter.update();
- this.valueAttributeOverrideContainer.update();
- this.valueAssociationOverrideContainer.update();
-
- this.setKeyType(this.buildKeyType());
- this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass());
-
- this.mapKeyColumn.update();
- this.mapKeyAttributeOverrideContainer.update();
- }
-
-
- // ********** target class **********
-
- public String getTargetClass() {
- return (this.specifiedTargetClass != null) ? this.specifiedTargetClass : this.defaultTargetClass;
- }
-
- public String getSpecifiedTargetClass() {
- return this.specifiedTargetClass;
- }
-
- public void setSpecifiedTargetClass(String targetClass) {
- this.setSpecifiedTargetClass_(targetClass);
- this.xmlAttributeMapping.setTargetClass(targetClass);
- }
-
- protected void setSpecifiedTargetClass_(String targetClass) {
- String old = this.specifiedTargetClass;
- this.specifiedTargetClass = targetClass;
- this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, targetClass);
- }
-
- public String getDefaultTargetClass() {
- return this.defaultTargetClass;
- }
-
- protected void setDefaultTargetClass(String targetClass) {
- String old = this.defaultTargetClass;
- this.defaultTargetClass = targetClass;
- this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, targetClass);
- }
-
- protected String buildDefaultTargetClass() {
- JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
- return (javaAttribute == null) ? null : javaAttribute.getMultiReferenceTargetTypeName();
- }
-
- public char getTargetClassEnclosingTypeSeparator() {
- return '$';
- }
-
-
- // ********** resolved target type/embeddable/entity **********
-
- public PersistentType getResolvedTargetType() {
- return this.resolvePersistentType(this.getTargetClass());
- }
-
- protected Embeddable getResolvedTargetEmbeddable() {
- TypeMapping typeMapping = this.getResolvedTargetTypeMapping();
- return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null;
- }
-
- protected Entity getResolvedTargetEntity() {
- TypeMapping typeMapping = this.getResolvedTargetTypeMapping();
- return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
- }
-
- protected TypeMapping getResolvedTargetTypeMapping() {
- PersistentType resolvedTargetType = this.getResolvedTargetType();
- return (resolvedTargetType == null) ? null : resolvedTargetType.getMapping();
- }
-
-
- // ********** fetch **********
-
- public FetchType getFetch() {
- return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch;
- }
-
- public FetchType getSpecifiedFetch() {
- return this.specifiedFetch;
- }
-
- public void setSpecifiedFetch(FetchType fetch) {
- this.setSpecifiedFetch_(fetch);
- this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch));
- }
-
- protected void setSpecifiedFetch_(FetchType fetch) {
- FetchType old = this.specifiedFetch;
- this.specifiedFetch = fetch;
- this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType buildSpecifiedFetch() {
- return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch());
- }
-
- public FetchType getDefaultFetch() {
- return this.defaultFetch;
- }
-
- protected void setDefaultFetch(FetchType fetch) {
- FetchType old = this.defaultFetch;
- this.defaultFetch = fetch;
- this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch);
- }
-
- protected FetchType buildDefaultFetch() {
- return DEFAULT_FETCH_TYPE;
- }
-
-
- // ********** orderable **********
-
- public OrmOrderable getOrderable() {
- return this.orderable;
- }
-
- protected OrmOrderable2_0 buildOrderable() {
- // we wouldn't be here if we weren't orm.xml 2.0 compatible
- return this.getContextNodeFactory2_0().buildOrmOrderable(this, this.buildOrderableOwner());
- }
-
- protected Orderable2_0.Owner buildOrderableOwner() {
- return new OrderableOwner();
- }
-
- protected class OrderableOwner
- implements Orderable2_0.Owner
- {
- public String getTableName() {
- return this.getCollectionTable().getName();
- }
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return this.getCollectionTable().getDbTable();
- }
- protected OrmCollectionTable2_0 getCollectionTable() {
- return AbstractOrmElementCollectionMapping2_0.this.getCollectionTable();
- }
- }
-
-
- // ********** collection table **********
-
- public OrmCollectionTable2_0 getCollectionTable() {
- return this.collectionTable;
- }
-
- protected OrmCollectionTable2_0 buildCollectionTable() {
- // we wouldn't be here if we weren't orm.xml 2.0 compatible
- 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 ReadOnlyTable.Owner
- {
- public JptValidator buildTableValidator(ReadOnlyTable 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();
- }
-
-
- // ********** 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 Iterable<String> getCandidateMapKeyNames() {
- return new CompositeIterable<String>(this.getAllTargetEmbeddableAttributeNamesLists());
- }
-
- /**
- * 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 Iterable<Iterable<String>> getAllTargetEmbeddableAttributeNamesLists() {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getAllTargetEmbeddableAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<AttributeMapping> getAllTargetEmbeddableAttributeMappings() {
- Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
- return (targetEmbeddable != null) ? targetEmbeddable.getAllAttributeMappings() : EmptyIterable.<AttributeMapping> instance();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Iterable<String> getAllMappingNames() {
- return new CompositeIterable<String>(super.getAllMappingNames(), this.getAllEmbeddableAttributeMappingNames());
- }
-
- protected Iterable<String> getAllEmbeddableAttributeMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER);
- }
-
- @Override
- public Iterable<String> getAllOverridableAttributeMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER);
- }
-
- @Override
- public Iterable<String> getAllOverridableAssociationMappingNames() {
- return this.getQualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER);
- }
-
- protected Iterable<String> getQualifiedEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<String, String>(this.getEmbeddableOverridableMappingNames(transformer), this.buildQualifierTransformer());
- }
-
- protected Iterable<String> getEmbeddableOverridableMappingNames(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new CompositeIterable<String>(this.getEmbeddableOverridableMappingNamesLists(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 Iterable<Iterable<String>> getEmbeddableOverridableMappingNamesLists(Transformer<AttributeMapping, Iterable<String>> transformer) {
- return new TransformationIterable<AttributeMapping, Iterable<String>>(this.getEmbeddableAttributeMappings(), 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 : this.getEmbeddableAttributeMappings()) {
- resolvedMapping = mapping.resolveAttributeMapping(attributeName);
- if (resolvedMapping != null) {
- return resolvedMapping;
- }
- }
- return null;
- }
-
- protected Iterable<AttributeMapping> getEmbeddableAttributeMappings() {
- Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable();
- return ((targetEmbeddable != null) && (targetEmbeddable != this.getTypeMapping())) ?
- targetEmbeddable.getAttributeMappings() :
- EmptyIterable.<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) {
- String targetClass = this.getTargetClass();
- if (StringTools.stringIsEmpty(targetClass)) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED,
- EMPTY_STRING_ARRAY,
- this,
- this.getValidationTextRange()
- )
- );
- return;
- }
-
- IJavaProject javaProject = this.getJpaProject().getJavaProject();
- if (JDTTools.findType(javaProject, targetClass) == null) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST,
- new String[] {this.name},
- this,
- this.getTargetClassTextRange()
- )
- );
- return;
- }
-
- if ( ! JDTTools.typeIsBasic(javaProject, targetClass) && (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.name},
- this,
- this.getTargetClassTextRange()
- )
- );
- }
- }
-
- protected TextRange getTargetClassTextRange() {
- return this.getValidationTextRange(this.xmlAttributeMapping.getTargetClassTextRange());
- }
-
- protected void validateMapKeyClass(List<IMessage> messages) {
- JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute();
- if ((javaAttribute != null) && ! javaAttribute.getJpaContainerDefinition().isMap()) {
- this.validateMapKeyClass_(messages);
- }
- }
-
- protected void validateMapKeyClass_(List<IMessage> messages) {
- 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()
- )
- );
- }
- }
-
- public void validateValue(List<IMessage> messages, IReporter reporter) {
- this.converter.validate(messages, 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);
- break;
- case EMBEDDABLE_TYPE :
- this.valueAttributeOverrideContainer.validate(messages, reporter);
- this.valueAssociationOverrideContainer.validate(messages, reporter);
- break;
- default :
- break;
- }
- }
-
- protected void validateMapKey(List<IMessage> messages, IReporter reporter) {
- if (this.getMapKey() == null) {
- this.validateMapKey_(messages, reporter);
- } else {
- //TODO validate that the map key refers to an existing attribute
- }
- }
-
- protected void validateMapKey_(List<IMessage> messages, IReporter reporter) {
- switch (this.keyType) {
- case BASIC_TYPE :
- this.mapKeyColumn.validate(messages, reporter);
- //validate map key converter
- break;
- case ENTITY_TYPE :
- //validate map key join columns
- break;
- case EMBEDDABLE_TYPE :
- this.mapKeyAttributeOverrideContainer.validate(messages, reporter);
- //validate map key association overrides
- break;
- default :
- break;
- }
- }
-
-
- // ********** abstract owner **********
-
- /**
- * the various (column and override) owners have lots of common
- * interactions with the mapping
- */
- protected abstract class AbstractOwner
- {
- public OrmTypeMapping getTypeMapping() {
- return AbstractOrmElementCollectionMapping2_0.this.getTypeMapping();
- }
-
- public String getDefaultTableName() {
- return this.getCollectionTable().getName();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- OrmCollectionTable2_0 table = this.getCollectionTable();
- return Tools.valuesAreEqual(table.getName(), tableName) ? table.getDbTable() : null;
- }
-
- public Iterable<String> getCandidateTableNames() {
- return EmptyIterable.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();
- }
-
- public Iterable<String> getJavaOverrideNames() {
- return null;
- }
-
- protected String getMappingName() {
- return AbstractOrmElementCollectionMapping2_0.this.getName();
- }
-
- 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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new NamedColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) 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(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new MapKeyColumnValidator(this.getPersistentAttribute(), (ReadOnlyBaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
- }
- }
-
-
- // ********** value association override container owner **********
-
- protected class ValueAssociationOverrideContainerOwner
- extends AbstractOwner
- implements OrmAssociationOverrideContainer2_0.Owner
- {
- public TypeMapping getOverridableTypeMapping() {
- return AbstractOrmElementCollectionMapping2_0.this.getResolvedTargetEmbeddable();
- }
-
- public Iterable<String> getAllOverridableNames() {
- TypeMapping typeMapping = this.getOverridableTypeMapping();
- return (typeMapping != null) ? typeMapping.getAllOverridableAssociationNames() : EmptyIterable.<String>instance();
- }
-
- public EList<XmlAssociationOverride> getXmlOverrides() {
- return this.getXmlMapping().getAssociationOverrides();
- }
-
- public Relationship resolveOverriddenRelationship(String attributeName) {
- return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName);
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyAssociationOverride) override, (ReadOnlyJoinColumn) column, (ReadOnlyJoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AssociationOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- throw this.buildJoinTableUnsupportedException();
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- throw this.buildJoinTableUnsupportedException();
- }
-
- public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- throw this.buildJoinTableUnsupportedException();
- }
-
- protected UnsupportedOperationException buildJoinTableUnsupportedException() {
- return new UnsupportedOperationException("An element collection containing a nested relationship mapping using a join table 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 Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? overriddenTypeMapping.getAllOverridableAttributeNames() : EmptyIterable.<String>instance();
- }
-
- public EList<XmlAttributeOverride> getXmlOverrides() {
- return this.getXmlMapping().getAttributeOverrides();
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new AttributeOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) 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 Iterable<String> getAllOverridableNames() {
- TypeMapping overriddenTypeMapping = this.getOverridableTypeMapping();
- return (overriddenTypeMapping != null) ? overriddenTypeMapping.getAllOverridableAttributeNames() : EmptyIterable.<String>instance();
- }
-
- public EList<XmlAttributeOverride> getXmlOverrides() {
- return this.getXmlMapping().getMapKeyAttributeOverrides();
- }
-
- public Column resolveOverriddenColumn(String attributeName) {
- return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName);
- }
-
- public JptValidator buildOverrideValidator(ReadOnlyOverride override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) {
- return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider());
- }
-
- public JptValidator buildColumnValidator(ReadOnlyOverride override, ReadOnlyBaseColumn column, ReadOnlyBaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) {
- return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (ReadOnlyAttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java
deleted file mode 100644
index 976ba93809..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java
+++ /dev/null
@@ -1,108 +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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0;
-
-/**
- * <code>orm.xml</code> cacheable
- */
-public class GenericOrmCacheable2_0
- extends AbstractOrmXmlContextNode
- implements OrmCacheable2_0
-{
- protected Boolean specifiedCacheable;
- protected boolean defaultCacheable;
-
-
- public GenericOrmCacheable2_0(OrmCacheableHolder2_0 parent) {
- super(parent);
- this.specifiedCacheable = this.getXmlCacheable().getCacheable();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedCacheable_(this.getXmlCacheable().getCacheable());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultCacheable(this.buildDefaultCacheable());
- }
-
-
- // ********** cacheable **********
-
- public boolean isCacheable() {
- return (this.specifiedCacheable != null) ? this.specifiedCacheable.booleanValue() : this.defaultCacheable;
- }
-
- public Boolean getSpecifiedCacheable() {
- return this.specifiedCacheable;
- }
-
- public void setSpecifiedCacheable(Boolean cacheable) {
- this.setSpecifiedCacheable_(cacheable);
- this.getXmlCacheable().setCacheable(cacheable);
- }
-
- protected void setSpecifiedCacheable_(Boolean cacheable) {
- Boolean old = this.specifiedCacheable;
- this.specifiedCacheable = cacheable;
- this.firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, old, cacheable);
- }
-
- public boolean isDefaultCacheable() {
- return this.defaultCacheable;
- }
-
- protected void setDefaultCacheable(boolean cacheable) {
- boolean old = this.defaultCacheable;
- this.defaultCacheable = cacheable;
- this.firePropertyChanged(DEFAULT_CACHEABLE_PROPERTY, old, cacheable);
- }
-
- protected boolean buildDefaultCacheable() {
- return this.getCacheableHolder().calculateDefaultCacheable();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmCacheableHolder2_0 getParent() {
- return (OrmCacheableHolder2_0) super.getParent();
- }
-
- protected OrmCacheableHolder2_0 getCacheableHolder() {
- return this.getParent();
- }
-
- protected XmlCacheable_2_0 getXmlCacheable() {
- return this.getCacheableHolder().getXmlCacheable();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlCacheable().getCacheableTextRange();
- return (textRange != null) ? textRange : this.getCacheableHolder().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
deleted file mode 100644
index 88adf54660..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java
+++ /dev/null
@@ -1,205 +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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmReferenceTable;
-import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
-
-/**
- * <code>orm.xml</code> collection table
- */
-public class GenericOrmCollectionTable2_0
- extends GenericOrmReferenceTable<XmlCollectionTable>
- implements OrmCollectionTable2_0
-{
- public GenericOrmCollectionTable2_0(OrmElementCollectionMapping2_0 parent, Owner owner) {
- super(parent, owner);
- }
-
- @Override
- protected OrmReadOnlyJoinColumn.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 OrmReadOnlyJoinColumn.Owner
- {
- protected JoinColumnOwner() {
- super();
- }
-
- public TypeMapping getTypeMapping() {
- return this.getElementCollectionMapping().getTypeMapping();
- }
-
- public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) {
- return Tools.valuesAreEqual(GenericOrmCollectionTable2_0.this.getName(), tableName) ?
- GenericOrmCollectionTable2_0.this.getDbTable() :
- null;
- }
-
- public String getDefaultColumnName() {
- //built in MappingTools.buildJoinColumnDefaultName()
- return null;
- }
-
- /**
- * by default, the join column is, obviously, in the collection table;
- * not sure whether it can be anywhere else...
- */
- public String getDefaultTableName() {
- return GenericOrmCollectionTable2_0.this.getName();
- }
-
- public TextRange getValidationTextRange() {
- return GenericOrmCollectionTable2_0.this.getValidationTextRange();
- }
-
- public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() {
- return this.getTypeMapping().getPrimaryDbTable();
- }
-
- public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) {
- return GenericOrmCollectionTable2_0.this.getDefaultJoinColumn() == joinColumn;
- }
-
- /**
- * the default table name is always valid and a specified table name
- * is prohibited (which will be handled elsewhere)
- */
- public boolean tableNameIsInvalid(String tableName) {
- return false;
- }
-
- public Iterable<String> getCandidateTableNames() {
- return EmptyIterable.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 getJoinColumnsSize() {
- return GenericOrmCollectionTable2_0.this.getJoinColumnsSize();
- }
-
- protected OrmElementCollectionMapping2_0 getElementCollectionMapping() {
- return GenericOrmCollectionTable2_0.this.getElementCollectionMapping();
- }
-
- public JptValidator buildColumnValidator(ReadOnlyNamedColumn column, NamedColumnTextRangeResolver textRangeResolver) {
- return new JoinColumnValidator(this.getPersistentAttribute(), (ReadOnlyJoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider());
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
deleted file mode 100644
index 11238fe493..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java
+++ /dev/null
@@ -1,173 +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.jpa.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmDerivedIdentity2_0
- extends AbstractOrmXmlContextNode
- implements OrmDerivedIdentity2_0
-{
- protected DerivedIdentityStrategy2_0 strategy;
-
- protected final OrmIdDerivedIdentityStrategy2_0 idStrategy;
-
- protected final 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 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 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);
- if (this.strategy != null) {
- ((XmlContextNode) this.strategy).validate(messages, reporter);
- }
- }
-
- public TextRange getValidationTextRange() {
- return this.getMapping().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java
deleted file mode 100644
index 105c822071..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
-
-public class GenericOrmElementCollectionMapping2_0
- extends AbstractOrmElementCollectionMapping2_0<XmlElementCollection>
-{
- public GenericOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, XmlElementCollection resourceMapping) {
- super(parent, resourceMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java
deleted file mode 100644
index 7d5525de4d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEmbeddable;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
-
-/**
- * JPA 2.0
- * <code>orm.xml</code> embeddable type mapping
- */
-public class GenericOrmEmbeddable2_0
- extends AbstractOrmEmbeddable<XmlEmbeddable>
-{
- public GenericOrmEmbeddable2_0(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
- super(parent, resourceMapping);
- }
-
- @Override
- public boolean attributeMappingKeyAllowed(String attributeMappingKey) {
- return ArrayTools.contains(GenericJavaEmbeddable2_0.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java
deleted file mode 100644
index c4515a0e2a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java
+++ /dev/null
@@ -1,115 +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.jpa.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmIdDerivedIdentityStrategy2_0
- extends AbstractOrmXmlContextNode
- implements OrmIdDerivedIdentityStrategy2_0
-{
- protected boolean value;
-
-
- public GenericOrmIdDerivedIdentityStrategy2_0(OrmDerivedIdentity2_0 parent) {
- super(parent);
- this.value = this.buildValue();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** value **********
-
- public boolean getValue() {
- return this.value;
- }
-
- public void setValue(boolean value) {
- this.setValue_(value);
- this.getXmlMapping().setId(value ? Boolean.TRUE : null);
- }
-
- protected void setValue_(boolean value) {
- boolean old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- protected boolean buildValue() {
- Boolean xmlValue = this.getXmlMapping().getId();
- return (xmlValue != null) && xmlValue.booleanValue();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmDerivedIdentity2_0 getParent() {
- return (OrmDerivedIdentity2_0) super.getParent();
- }
-
- protected OrmDerivedIdentity2_0 getDerivedIdentity() {
- return this.getParent();
- }
-
- protected OrmSingleRelationshipMapping2_0 getMapping() {
- return this.getDerivedIdentity().getMapping();
- }
-
- protected XmlSingleRelationshipMapping_2_0 getXmlMapping() {
- return this.getMapping().getXmlAttributeMapping();
- }
-
- public boolean isSpecified() {
- return this.value;
- }
-
- public void addStrategy() {
- this.setValue(true);
- }
-
- public void removeStrategy() {
- this.setValue(false);
- }
-
- public void initializeFrom(OrmIdDerivedIdentityStrategy2_0 oldStrategy) {
- this.setValue(oldStrategy.getValue());
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- // no validation rules
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlMapping().getIdTextRange();
- return (textRange != null) ? textRange : this.getDerivedIdentity().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java
deleted file mode 100644
index 6432e46e11..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java
+++ /dev/null
@@ -1,282 +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.jpa.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.NotNullFilter;
-import org.eclipse.jpt.common.utility.internal.Tools;
-import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmMapsIdDerivedIdentityStrategy2_0
- extends AbstractOrmXmlContextNode
- implements OrmMapsIdDerivedIdentityStrategy2_0
-{
- protected String specifiedIdAttributeName;
- // no default
-
-
- public GenericOrmMapsIdDerivedIdentityStrategy2_0(OrmDerivedIdentity2_0 parent) {
- super(parent);
- this.specifiedIdAttributeName = this.getXmlMapping().getMapsId();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedIdAttributeName_(this.getXmlMapping().getMapsId());
- }
-
-
- // ********** ID attribute name **********
-
- public String getIdAttributeName() {
- // there is no default
- return this.specifiedIdAttributeName;
- }
-
- public String getSpecifiedIdAttributeName() {
- return this.specifiedIdAttributeName;
- }
-
- public void setSpecifiedIdAttributeName(String idAttributeName) {
- this.setSpecifiedIdAttributeName_(idAttributeName);
- this.getXmlMapping().setMapsId(idAttributeName);
- }
-
- protected void setSpecifiedIdAttributeName_(String idAttributeName) {
- String old = this.specifiedIdAttributeName;
- this.specifiedIdAttributeName = idAttributeName;
- this.firePropertyChanged(SPECIFIED_ID_ATTRIBUTE_NAME_PROPERTY, old, idAttributeName);
- }
-
- public String getDefaultIdAttributeName() {
- // there is no way to have a default in xml
- return null;
- }
-
- public boolean defaultIdAttributeNameIsPossible() {
- 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().getAllAttributeMappings());
- }
-
- public Iterable<String> getSortedCandidateIdAttributeNames() {
- return CollectionTools.sort(this.getNonNullCandidateIdAttributeNames());
- }
-
- protected Iterable<String> getNonNullCandidateIdAttributeNames() {
- return new FilteringIterable<String>(this.getCandidateIdAttributeNames(), NotNullFilter.<String>instance());
- }
-
- protected Iterable<String> getCandidateIdAttributeNames() {
- return new TransformationIterable<AttributeMapping, String>(this.getCandidateIdAttributeMappings()) {
- @Override
- protected String transform(AttributeMapping mapping) {
- return mapping.getName();
- }
- };
- }
-
- protected Iterable<AttributeMapping> getCandidateIdAttributeMappings() {
- return this.buildCandidateIdAttributeMappings(this.getAllAttributeMappings());
- }
-
- protected Iterable<AttributeMapping> buildCandidateIdAttributeMappings(Iterable<AttributeMapping> attributeMappings) {
- return new CompositeIterable<AttributeMapping>(this.getCandidateIdAttributeMappingLists(attributeMappings));
- }
-
- protected Iterable<Iterable<AttributeMapping>> getCandidateIdAttributeMappingLists(Iterable<AttributeMapping> attributeMappings) {
- return new TransformationIterable<AttributeMapping, Iterable<AttributeMapping>>(attributeMappings) {
- @Override
- protected Iterable<AttributeMapping> transform(AttributeMapping attributeMapping) {
- return Tools.valuesAreEqual(attributeMapping.getKey(), MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) ?
- this.getEmbeddedIdMappingChoiceIterable((EmbeddedIdMapping) attributeMapping) :
- new SingleElementIterable<AttributeMapping>(attributeMapping);
- }
-
- /**
- * 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.
- *
- * NB: Recursion is unnecessary.
- */
- 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.getAllAttributeMappings())
- );
- }
- };
- }
-
-
- public AttributeMapping getDerivedIdAttributeMapping() {
- String idAttributeName = this.getIdAttributeName();
- if (idAttributeName != null) {
- for (AttributeMapping mapping : this.getCandidateIdAttributeMappings()) {
- if (idAttributeName.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.setSpecifiedIdAttributeName(oldStrategy.getSpecifiedIdAttributeName());
- }
-
-
- // ********** 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 id attribute name can be resolved
- AttributeMapping attributeMapping = this.getDerivedIdAttributeMapping();
- if (attributeMapping == null) {
- // there is no defaulting, so only use the 'resolved' error, even if the name is an empty string
- messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_NOT_RESOLVED, new String[] {this.getIdAttributeName()}));
- } 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.getIdAttributeName()}));
- }
- }
- }
-
- protected Iterable<AttributeMapping> getValidAttributeMappingChoices() {
- return this.buildCandidateIdAttributeMappings(this.getIdAttributeMappings());
- }
-
- protected IMessage buildMessage(String msgID, String[] parms) {
- 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()
- );
- }
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlMapping().getMapsIdTextRange();
- return (textRange != null) ? textRange : this.getDerivedIdentity().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
deleted file mode 100644
index e948cccc1e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java
+++ /dev/null
@@ -1,104 +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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery;
-import org.eclipse.jpt.jpa.core.internal.jpql.JpaJpqlQueryHelper;
-import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmNamedQuery2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * 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;
- }
-
- // ********** validation **********
-
- @Override
- protected void validateQuery_(java.util.List<IMessage> messages, IReporter reporter) {
- // Convert the literal escape characters into actual escape characters
- String jpqlQuery = ExpressionTools.unescape(this.query, new int[1]);
-
- JpaJpqlQueryHelper helper = new JpaJpqlQueryHelper();
- helper.validate(this, jpqlQuery, this.getQueryTextRange(), 0, messages);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java
deleted file mode 100644
index 48922a3903..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn;
-
-/**
- * <code>orm.xml</code> order column
- */
-public class GenericOrmOrderColumn2_0
- extends AbstractOrmNamedColumn<XmlOrderColumn, OrmOrderColumn2_0.Owner>
- implements OrmOrderColumn2_0
-{
- // TODO defaults from java for all of these settings
- protected Boolean specifiedNullable;
-
- protected Boolean specifiedInsertable;
-
- protected Boolean specifiedUpdatable;
-
-
- public GenericOrmOrderColumn2_0(OrmOrderable2_0 parent, OrmOrderColumn2_0.Owner owner) {
- super(parent, owner);
- this.specifiedNullable = this.buildSpecifiedNullable();
- this.specifiedInsertable = this.buildSpecifiedInsertable();
- this.specifiedUpdatable = this.buildSpecifiedUpdatable();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedNullable_(this.buildSpecifiedNullable());
- this.setSpecifiedInsertable_(this.buildSpecifiedInsertable());
- this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable());
- }
-
-
- // ********** XML column **********
-
- @Override
- public XmlOrderColumn getXmlColumn() {
- return this.owner.getXmlColumn();
- }
-
- @Override
- protected XmlOrderColumn buildXmlColumn() {
- return this.owner.buildXmlColumn();
- }
-
- @Override
- protected void removeXmlColumn() {
- this.owner.removeXmlColumn();
- }
-
-
- // ********** nullable **********
-
- public boolean isNullable() {
- return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable();
- }
-
- public Boolean getSpecifiedNullable() {
- return this.specifiedNullable;
- }
-
- public void setSpecifiedNullable(Boolean nullable) {
- if (this.valuesAreDifferent(this.specifiedNullable, nullable)) {
- XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedNullable_(nullable);
- xmlColumn.setNullable(nullable);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedNullable_(Boolean nullable) {
- Boolean old = this.specifiedNullable;
- this.specifiedNullable = nullable;
- this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable);
- }
-
- protected Boolean buildSpecifiedNullable() {
- XmlOrderColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getNullable();
- }
-
- public boolean isDefaultNullable() {
- return DEFAULT_NULLABLE;
- }
-
-
- // ********** insertable **********
-
- public boolean isInsertable() {
- return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable();
- }
-
- public Boolean getSpecifiedInsertable() {
- return this.specifiedInsertable;
- }
-
- public void setSpecifiedInsertable(Boolean insertable) {
- if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) {
- XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedInsertable_(insertable);
- xmlColumn.setInsertable(insertable);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedInsertable_(Boolean insertable) {
- Boolean old = this.specifiedInsertable;
- this.specifiedInsertable = insertable;
- this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable);
- }
-
- protected Boolean buildSpecifiedInsertable() {
- XmlOrderColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getInsertable();
- }
-
- public boolean isDefaultInsertable() {
- return DEFAULT_INSERTABLE;
- }
-
-
- // ********** updatable **********
-
- public boolean isUpdatable() {
- return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable();
- }
-
- public Boolean getSpecifiedUpdatable() {
- return this.specifiedUpdatable;
- }
-
- public void setSpecifiedUpdatable(Boolean updatable) {
- if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) {
- XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate();
- this.setSpecifiedUpdatable_(updatable);
- xmlColumn.setUpdatable(updatable);
- this.removeXmlColumnIfUnset();
- }
- }
-
- protected void setSpecifiedUpdatable_(Boolean updatable) {
- Boolean old = this.specifiedUpdatable;
- this.specifiedUpdatable = updatable;
- this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable);
- }
-
- protected Boolean buildSpecifiedUpdatable() {
- XmlOrderColumn xmlColumn = this.getXmlColumn();
- return (xmlColumn == null) ? null : xmlColumn.getUpdatable();
- }
-
- public boolean isDefaultUpdatable() {
- return DEFAULT_UPDATABLE;
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmOrderable2_0 getParent() {
- return (OrmOrderable2_0) super.getParent();
- }
-
- protected OrmOrderable2_0 getOrderable() {
- return this.getParent();
- }
-
- protected OrmAttributeMapping getAttributeMapping() {
- return this.getOrderable().getParent();
- }
-
- protected PersistentAttribute getPersistentAttribute() {
- return this.getAttributeMapping().getPersistentAttribute();
- }
-
- @Override
- public String getTable() {
- return this.getParent().getDefaultTableName();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java
deleted file mode 100644
index e338f9655e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java
+++ /dev/null
@@ -1,118 +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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0;
-
-/**
- * <code>orm.xml</code> orphan removal
- */
-public class GenericOrmOrphanRemoval2_0
- extends AbstractOrmXmlContextNode
- implements OrmOrphanRemovable2_0
-{
- protected Boolean specifiedOrphanRemoval;
- protected boolean defaultOrphanRemoval;
-
-
- public GenericOrmOrphanRemoval2_0(OrmOrphanRemovalHolder2_0 parent) {
- super(parent);
- this.specifiedOrphanRemoval = this.buildSpecifiedOrphanRemoval();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedOrphanRemoval_(this.buildSpecifiedOrphanRemoval());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultOrphanRemoval(this.buildDefaultOrphanRemoval());
- }
-
-
- // ********** orphan removal **********
-
- public boolean isOrphanRemoval() {
- return (this.specifiedOrphanRemoval != null) ? this.specifiedOrphanRemoval.booleanValue() : this.defaultOrphanRemoval;
- }
-
- public Boolean getSpecifiedOrphanRemoval() {
- return this.specifiedOrphanRemoval;
- }
-
- public void setSpecifiedOrphanRemoval(Boolean orphanRemoval) {
- this.setSpecifiedOrphanRemoval_(orphanRemoval);
- this.getXmlOrphanRemovable().setOrphanRemoval(orphanRemoval);
- }
-
- protected void setSpecifiedOrphanRemoval_(Boolean orphanRemoval) {
- Boolean old = this.specifiedOrphanRemoval;
- this.specifiedOrphanRemoval = orphanRemoval;
- this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
- }
-
- protected Boolean buildSpecifiedOrphanRemoval() {
- return this.getXmlOrphanRemovable().getOrphanRemoval();
- }
-
- public boolean isDefaultOrphanRemoval() {
- return this.defaultOrphanRemoval;
- }
-
- protected void setDefaultOrphanRemoval(boolean orphanRemoval) {
- boolean old = this.defaultOrphanRemoval;
- this.defaultOrphanRemoval = orphanRemoval;
- this.firePropertyChanged(DEFAULT_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
- }
-
- protected boolean buildDefaultOrphanRemoval() {
- return DEFAULT_ORPHAN_REMOVAL;
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmOrphanRemovalHolder2_0 getParent() {
- return (OrmOrphanRemovalHolder2_0) super.getParent();
- }
-
- protected OrmAttributeMapping getMapping() {
- return (OrmAttributeMapping) this.getParent();
- }
-
- protected XmlAttributeMapping getXmlMapping() {
- return this.getMapping().getXmlAttributeMapping();
- }
-
- protected XmlOrphanRemovable_2_0 getXmlOrphanRemovable() {
- return (XmlOrphanRemovable_2_0) this.getXmlMapping();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- TextRange textRange = this.getXmlOrphanRemovable().getValidationTextRange();
- return (textRange != null) ? textRange : this.getMapping().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java
deleted file mode 100644
index ce3c95d40b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOverrideRelationship2_0;
-
-public class GenericOrmOverrideJoinTableRelationshipStrategy2_0
- extends AbstractOrmJoinTableRelationshipStrategy
-{
- public GenericOrmOverrideJoinTableRelationshipStrategy2_0(OrmOverrideRelationship2_0 parent) {
- super(parent);
- }
-
-
- @Override
- public OrmOverrideRelationship2_0 getRelationship() {
- return (OrmOverrideRelationship2_0) super.getRelationship();
- }
-
- public boolean isOverridable() {
- return false;
- }
-
-
- // ********** validation **********
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationship().getTypeMapping().validatesAgainstDatabase();
- }
-
- public TextRange getValidationTextRange() {
- return this.getRelationship().getValidationTextRange();
- }
-
- public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableValidator((ReadOnlyJoinTable) table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java
deleted file mode 100644
index 548a4a0f50..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSequenceGenerator2_0;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-
-/**
- * JPA 2.0
- * <code>orm.xml</code> sequence generator
- */
-public class GenericOrmSequenceGenerator2_0
- extends AbstractOrmSequenceGenerator
- implements OrmSequenceGenerator2_0
-{
- protected String specifiedCatalog;
- protected String defaultCatalog;
-
- protected String specifiedSchema;
- protected String defaultSchema;
-
-
- public GenericOrmSequenceGenerator2_0(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) {
- super(parent, xmlSequenceGenerator);
- this.specifiedCatalog = xmlSequenceGenerator.getCatalog();
- this.specifiedSchema = xmlSequenceGenerator.getSchema();
- }
-
-
- // ********** synchronize/update **********
-
- @Override
- public void synchronizeWithResourceModel() {
- super.synchronizeWithResourceModel();
- this.setSpecifiedCatalog_(this.xmlGenerator.getCatalog());
- this.setSpecifiedSchema_(this.xmlGenerator.getSchema());
- }
-
- @Override
- public void update() {
- super.update();
- this.setDefaultCatalog(this.buildDefaultCatalog());
- this.setDefaultSchema(this.buildDefaultSchema());
- }
-
-
- // ********** catalog **********
-
- @Override
- public String getCatalog() {
- return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog;
- }
-
- public String getSpecifiedCatalog() {
- return this.specifiedCatalog;
- }
-
- public void setSpecifiedCatalog(String catalog) {
- this.setSpecifiedCatalog_(catalog);
- this.xmlGenerator.setCatalog(catalog);
- }
-
- protected void setSpecifiedCatalog_(String catalog) {
- String old = this.specifiedCatalog;
- this.specifiedCatalog = catalog;
- this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog);
- }
-
- public String getDefaultCatalog() {
- return this.defaultCatalog;
- }
-
- protected void setDefaultCatalog(String catalog) {
- String old = this.defaultCatalog;
- this.defaultCatalog = catalog;
- this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog);
- }
-
- protected String buildDefaultCatalog() {
- return this.getContextDefaultCatalog();
- }
-
-
- // ********** schema **********
-
- @Override
- public String getSchema() {
- return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema;
- }
-
- public String getSpecifiedSchema() {
- return this.specifiedSchema;
- }
-
- public void setSpecifiedSchema(String schema) {
- this.setSpecifiedSchema_(schema);
- this.xmlGenerator.setSchema(schema);
- }
-
- protected void setSpecifiedSchema_(String schema) {
- String old = this.specifiedSchema;
- this.specifiedSchema = schema;
- this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema);
- }
-
- public String getDefaultSchema() {
- return this.defaultSchema;
- }
-
- protected void setDefaultSchema(String schema) {
- String old = this.defaultSchema;
- this.defaultSchema = schema;
- this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema);
- }
-
- protected String buildDefaultSchema() {
- return this.getContextDefaultSchema();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java
deleted file mode 100644
index 79133360e8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java
+++ /dev/null
@@ -1,152 +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.jpa.core.internal.jpa2.context.orm;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
-import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy;
-import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
-import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
-import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmVirtualOverrideRelationship2_0;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-public class GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0
- extends AbstractOrmXmlContextNode
- implements OrmVirtualJoinTableRelationshipStrategy, ReadOnlyTable.Owner
-{
- protected OrmVirtualJoinTable joinTable;
-
-
- public GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0(OrmVirtualOverrideRelationship2_0 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() {
- ReadOnlyJoinTable 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 ReadOnlyJoinTable getOverriddenJoinTable() {
- ReadOnlyJoinTableRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy();
- return (overriddenStrategy == null) ? null : overriddenStrategy.getJoinTable();
- }
-
- protected OrmVirtualJoinTable buildJoinTable(ReadOnlyJoinTable overriddenJoinTable) {
- return this.getContextNodeFactory().buildOrmVirtualJoinTable(this, this, overriddenJoinTable);
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmVirtualOverrideRelationship2_0 getParent() {
- return (OrmVirtualOverrideRelationship2_0) super.getParent();
- }
-
- public OrmVirtualOverrideRelationship2_0 getRelationship() {
- return this.getParent();
- }
-
- protected ReadOnlyJoinTableRelationshipStrategy getOverriddenStrategy() {
- ReadOnlyJoinTableRelationship relationship = this.getOverriddenJoinTableRelationship();
- return (relationship == null) ? null : relationship.getJoinTableStrategy();
- }
-
- protected ReadOnlyJoinTableRelationship getOverriddenJoinTableRelationship() {
- ReadOnlyRelationship relationship = this.resolveOverriddenRelationship();
- return (relationship instanceof ReadOnlyJoinTableRelationship) ? (ReadOnlyJoinTableRelationship) relationship : null;
- }
-
- protected ReadOnlyRelationship resolveOverriddenRelationship() {
- return this.getRelationship().resolveOverriddenRelationship();
- }
-
- public String getTableName() {
- return this.joinTable.getName();
- }
-
- public String getJoinTableDefaultName() {
- return MappingTools.buildJoinTableDefaultName(this.getRelationship());
- }
-
-
- // ********** validation **********
-
- @Override
- public void validate(List<IMessage> messages, IReporter reporter) {
- super.validate(messages, reporter);
- if (this.joinTable != null) {
- this.joinTable.validate(messages, reporter);
- }
- }
-
- public boolean validatesAgainstDatabase() {
- return this.getRelationship().getTypeMapping().validatesAgainstDatabase();
- }
-
- public TextRange getValidationTextRange() {
- return this.getRelationship().getValidationTextRange();
- }
-
- public JptValidator buildTableValidator(ReadOnlyTable table, TableTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableValidator((ReadOnlyJoinTable) table, textRangeResolver);
- }
-
- public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver);
- }
-
- public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) {
- return this.getRelationship().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java
deleted file mode 100644
index f4e06e1ed5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java
+++ /dev/null
@@ -1,101 +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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.jpa.core.context.Table;
-import org.eclipse.jpt.jpa.core.context.XmlContextNode;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery;
-import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOrderable;
-import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmEmbeddedMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator;
-
-public class GenericOrmXml2_0ContextNodeFactory
- extends AbstractOrmXmlContextNodeFactory
- implements OrmXml2_0ContextNodeFactory
-{
- @Override
- public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) {
- throw new UnsupportedOperationException("use #buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner)"); //$NON-NLS-1$
- }
-
- @Override
- public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) {
- return new GenericOrmEmbeddable2_0(parent, resourceMapping);
- }
-
- @Override
- public OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator) {
- return new GenericOrmSequenceGenerator2_0(parent, resourceSequenceGenerator);
- }
-
- public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEmbeddedMapping2_0 parent, OrmAssociationOverrideContainer2_0.Owner owner) {
- return new GenericOrmAssociationOverrideContainer(parent, owner);
- }
-
- public OrmDerivedIdentity2_0 buildOrmDerivedIdentity(OrmSingleRelationshipMapping2_0 parent) {
- return new GenericOrmDerivedIdentity2_0(parent);
- }
-
- public OrmElementCollectionMapping2_0 buildOrmElementCollectionMapping2_0(
- OrmPersistentAttribute parent, XmlElementCollection resourceMapping) {
-
- return new GenericOrmElementCollectionMapping2_0(parent, resourceMapping);
- }
-
- public OrmCacheable2_0 buildOrmCacheable(OrmCacheableHolder2_0 parent) {
- return new GenericOrmCacheable2_0(parent);
- }
-
- public OrmOrphanRemovable2_0 buildOrmOrphanRemoval(OrmOrphanRemovalHolder2_0 parent) {
- return new GenericOrmOrphanRemoval2_0(parent);
- }
-
- @Override
- public OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) {
- return new GenericOrmNamedQuery2_0(parent, resourceNamedQuery);
- }
-
- public OrmCollectionTable2_0 buildOrmCollectionTable(OrmElementCollectionMapping2_0 parent, Table.Owner owner) {
- return new GenericOrmCollectionTable2_0(parent, owner);
- }
-
- public OrmOrderable2_0 buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner) {
- return new GenericOrmOrderable(parent, owner);
- }
-
- public OrmOrderColumn2_0 buildOrmOrderColumn(OrmOrderable2_0 parent, OrmOrderColumn2_0.Owner owner) {
- return new GenericOrmOrderColumn2_0(parent, owner);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java
deleted file mode 100644
index 25d286b699..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.orm;
-
-import java.util.ArrayList;
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEntityDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmMappedSuperclassDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition;
-import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaPlatformProvider;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-
-public class GenericOrmXml2_0Definition
- extends AbstractOrmXmlDefinition
-{
- // singleton
- private static final OrmXmlDefinition INSTANCE = new GenericOrmXml2_0Definition();
-
- /**
- * Return the singleton
- */
- public static OrmXmlDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private GenericOrmXml2_0Definition() {
- super();
- }
-
- public JptResourceType getResourceType() {
- return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE;
- }
-
- public EFactory getResourceNodeFactory() {
- return OrmFactory.eINSTANCE;
- }
-
- @Override
- protected OrmXmlContextNodeFactory buildContextNodeFactory() {
- return new GenericOrmXml2_0ContextNodeFactory();
- }
-
- @Override
- protected void addTypeMappingDefinitionsTo(ArrayList<OrmTypeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS);
- }
-
- /**
- * Order should not matter here; but we'll use the same order as for Java.
- * @see Generic2_0JpaPlatformProvider
- */
- protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] {
- OrmEntityDefinition.instance(),
- OrmEmbeddableDefinition.instance(),
- OrmMappedSuperclassDefinition.instance()
- };
-
- @Override
- protected void addAttributeMappingDefinitionsTo(ArrayList<OrmAttributeMappingDefinition> definitions) {
- CollectionTools.addAll(definitions, ATTRIBUTE_MAPPING_DEFINITIONS);
- }
-
- /**
- * Order should not matter here; but we'll use the same order as for Java.
- * @see Generic2_0JpaPlatformProvider
- */
- protected static final OrmAttributeMappingDefinition[] ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] {
- OrmTransientMappingDefinition.instance(),
- OrmElementCollectionMapping2_0Definition.instance(),
- OrmIdMappingDefinition.instance(),
- OrmVersionMappingDefinition.instance(),
- OrmBasicMappingDefinition.instance(),
- OrmEmbeddedMappingDefinition.instance(),
- OrmEmbeddedIdMappingDefinition.instance(),
- OrmManyToManyMappingDefinition.instance(),
- OrmManyToOneMappingDefinition.instance(),
- OrmOneToManyMappingDefinition.instance(),
- OrmOneToOneMappingDefinition.instance(),
- NullOrmAttributeMappingDefinition.instance()
- };
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java
deleted file mode 100644
index 1a8eef92ed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0;
-
-/**
- * null <code>orm.xml</code> cacheable
- */
-public class NullOrmCacheable2_0
- extends AbstractOrmXmlContextNode
- implements OrmCacheable2_0
-{
- public NullOrmCacheable2_0(OrmCacheableHolder2_0 parent) {
- super(parent);
- }
-
-
- // ********** cacheable **********
-
- public boolean isCacheable() {
- return false;
- }
-
- public Boolean getSpecifiedCacheable() {
- return null;
- }
-
- public void setSpecifiedCacheable(Boolean cacheable) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isDefaultCacheable() {
- return false;
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmCacheableHolder2_0 getParent() {
- return (OrmCacheableHolder2_0) super.getParent();
- }
-
-
- // ********** validation **********
-
- public TextRange getValidationTextRange() {
- return this.getParent().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java
deleted file mode 100644
index 62e50aa57d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java
+++ /dev/null
@@ -1,96 +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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0;
-
-public class NullOrmDerivedIdentity2_0
- extends AbstractXmlContextNode
- implements OrmDerivedIdentity2_0
-{
- public NullOrmDerivedIdentity2_0(OrmSingleRelationshipMapping2_0 parent) {
- super(parent);
- }
-
-
-
- // ********** predominant derived identity strategy **********
-
- public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() {
- return null;
- }
-
-
- // ********** null derived identity strategy **********
-
- public boolean usesNullDerivedIdentityStrategy() {
- return true;
- }
-
- public void setNullDerivedIdentityStrategy() {
- // NOP
- }
-
-
- // ********** ID derived identity strategy **********
-
- public OrmIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() {
- return null;
- }
-
- public boolean usesIdDerivedIdentityStrategy() {
- return false;
- }
-
- public void setIdDerivedIdentityStrategy() {
- // NOP
- }
-
-
- // ********** maps ID derived identity strategy **********
-
- public OrmMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() {
- return null;
- }
-
- public boolean usesMapsIdDerivedIdentityStrategy() {
- return false;
- }
-
- public void setMapsIdDerivedIdentityStrategy() {
- // NOP
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmSingleRelationshipMapping2_0 getParent() {
- return (OrmSingleRelationshipMapping2_0) super.getParent();
- }
-
- public OrmSingleRelationshipMapping2_0 getMapping() {
- return this.getParent();
- }
-
- public void initializeFrom(OrmDerivedIdentity2_0 oldDerivedIdentity) {
- // NOP
- }
-
- public TextRange getValidationTextRange() {
- return this.getMapping().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java
deleted file mode 100644
index 104cef2cc6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java
+++ /dev/null
@@ -1,58 +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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0;
-
-/**
- * Null <code>orm.xml</code> orphan removal
- */
-public class NullOrmOrphanRemoval2_0
- extends AbstractOrmXmlContextNode
- implements OrmOrphanRemovable2_0
-{
- public NullOrmOrphanRemoval2_0(OrmOrphanRemovalHolder2_0 parent) {
- super(parent);
- }
-
-
- // ********** orphan removal **********
-
- public boolean isDefaultOrphanRemoval() {
- return false;
- }
-
- public boolean isOrphanRemoval() {
- return false;
- }
-
- public Boolean getSpecifiedOrphanRemoval() {
- return null;
- }
-
- public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** misc **********
-
- @Override
- public OrmOrphanRemovalHolder2_0 getParent() {
- return (OrmOrphanRemovalHolder2_0) super.getParent();
- }
-
- public TextRange getValidationTextRange() {
- return this.getParent().getValidationTextRange();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java
deleted file mode 100644
index 44e92594b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.orm;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection;
-import org.eclipse.jpt.jpa.core.resource.xml.EmfTools;
-
-public class OrmElementCollectionMapping2_0Definition
- implements OrmAttributeMappingDefinition
-{
- // singleton
- private static final OrmAttributeMappingDefinition INSTANCE =
- new OrmElementCollectionMapping2_0Definition();
-
-
- /**
- * Return the singleton
- */
- public static OrmAttributeMappingDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private OrmElementCollectionMapping2_0Definition() {
- super();
- }
-
-
- public String getKey() {
- return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY;
- }
-
- public XmlAttributeMapping buildResourceMapping(EFactory factory) {
- return EmfTools.create(
- factory,
- OrmPackage.eINSTANCE.getXmlElementCollection(),
- XmlElementCollection.class);
- }
-
- public OrmAttributeMapping buildContextMapping(
- OrmPersistentAttribute parent,
- XmlAttributeMapping xmlMapping,
- OrmXmlContextNodeFactory factory) {
- return ((OrmXml2_0ContextNodeFactory) factory).buildOrmElementCollectionMapping2_0(parent, (XmlElementCollection) xmlMapping);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java
deleted file mode 100644
index cc6131ac51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.persistence;
-
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.GenericConnection2_0;
-import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.GenericOptions2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0;
-
-
-public class Generic2_0PersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory
-{
-
- public JpaConnection2_0 buildConnection(PersistenceUnit parent) {
- return new GenericConnection2_0(parent);
- }
-
- public JpaOptions2_0 buildOptions(PersistenceUnit parent) {
- return new GenericOptions2_0(parent);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java
deleted file mode 100644
index c2ea049fd9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.persistence;
-
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.jpt.common.core.JptResourceType;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition;
-import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory;
-
-public class Generic2_0PersistenceXmlDefinition
- extends AbstractPersistenceXmlDefinition
-{
- // singleton
- private static final PersistenceXmlDefinition INSTANCE = new Generic2_0PersistenceXmlDefinition();
-
- /**
- * Return the singleton
- */
- public static PersistenceXmlDefinition instance() {
- return INSTANCE;
- }
-
-
- /**
- * Enforce singleton usage
- */
- private Generic2_0PersistenceXmlDefinition() {
- super();
- }
-
- public JptResourceType getResourceType() {
- return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE;
- }
-
- public EFactory getResourceNodeFactory() {
- return PersistenceV2_0Factory.eINSTANCE;
- }
-
- @Override
- protected PersistenceXmlContextNodeFactory buildContextNodeFactory() {
- return new Generic2_0PersistenceXmlContextNodeFactory();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java
deleted file mode 100644
index f8129b5932..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.persistence.connection;
-
-import java.util.Map;
-
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0;
-
-/**
- * GenericConnection2_0
- */
-public class GenericConnection2_0 extends AbstractPersistenceUnitProperties
- implements JpaConnection2_0
-{
- // ********** GenericConnection properties **********
- private String driver;
- private String url;
- private String user;
- private String password;
-
-
- // ********** constructors **********
- public GenericConnection2_0(PersistenceUnit parent) {
- super(parent);
- }
-
- // ********** initialization **********
- /**
- * Initializes properties with values from the persistence unit.
- */
- @Override
- protected void initializeProperties() {
- this.driver =
- this.getStringValue(PERSISTENCE_JDBC_DRIVER);
- this.url =
- this.getStringValue(PERSISTENCE_JDBC_URL);
- this.user =
- this.getStringValue(PERSISTENCE_JDBC_USER);
- this.password =
- this.getStringValue(PERSISTENCE_JDBC_PASSWORD);
- }
-
- // ********** behavior **********
-
- public void propertyValueChanged(String propertyName, String newValue) {
- if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) {
- this.driverChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_URL)) {
- this.urlChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_USER)) {
- this.userChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) {
- this.passwordChanged(newValue);
- }
- }
-
- public void propertyRemoved(String propertyName) {
- if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) {
- this.driverChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_URL)) {
- this.urlChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_USER)) {
- this.userChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) {
- this.passwordChanged(null);
- }
- }
-
- /**
- * Adds property names key/value pairs, where:
- * key = PU property key
- * value = property id
- */
- @Override
- protected void addPropertyNames(Map<String, String> propertyNames) {
- propertyNames.put(
- PERSISTENCE_JDBC_DRIVER,
- DRIVER_PROPERTY);
- propertyNames.put(
- PERSISTENCE_JDBC_URL,
- URL_PROPERTY);
- propertyNames.put(
- PERSISTENCE_JDBC_USER,
- USER_PROPERTY);
- propertyNames.put(
- PERSISTENCE_JDBC_PASSWORD,
- PASSWORD_PROPERTY);
- }
-
- // ********** Driver **********
- public String getDriver() {
- return this.driver;
- }
-
- public void setDriver(String newDriver) {
- String old = this.driver;
- this.driver = newDriver;
- this.putProperty(DRIVER_PROPERTY, newDriver);
- this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver);
- }
-
- private void driverChanged(String newValue) {
- String old = this.driver;
- this.driver = newValue;
- this.firePropertyChanged(DRIVER_PROPERTY, old, newValue);
- }
-
- public String getDefaultDriver() {
- return DEFAULT_JDBC_DRIVER;
- }
-
- // ********** URL **********
- public String getUrl() {
- return this.url;
- }
-
- public void setUrl(String newUrl) {
- String old = this.url;
- this.url = newUrl;
- this.putProperty(URL_PROPERTY, newUrl);
- this.firePropertyChanged(URL_PROPERTY, old, newUrl);
- }
-
- private void urlChanged(String newValue) {
- String old = this.url;
- this.url = newValue;
- this.firePropertyChanged(URL_PROPERTY, old, newValue);
- }
-
- public String getDefaultUrl() {
- return DEFAULT_JDBC_URL;
- }
-
- // ********** User **********
- public String getUser() {
- return this.user;
- }
-
- public void setUser(String newUser) {
- String old = this.user;
- this.user = newUser;
- this.putProperty(USER_PROPERTY, newUser);
- this.firePropertyChanged(USER_PROPERTY, old, newUser);
- }
-
- private void userChanged(String newValue) {
- String old = this.user;
- this.user = newValue;
- this.firePropertyChanged(USER_PROPERTY, old, newValue);
- }
-
- public String getDefaultUser() {
- return DEFAULT_JDBC_USER;
- }
-
- // ********** Password **********
- public String getPassword() {
- return this.password;
- }
-
- public void setPassword(String newPassword) {
- String old = this.password;
- this.password = newPassword;
- this.putProperty(PASSWORD_PROPERTY, newPassword);
- this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword);
- }
-
- private void passwordChanged(String newValue) {
- String old = this.password;
- this.password = newValue;
- this.firePropertyChanged(PASSWORD_PROPERTY, old, newValue);
- }
-
- public String getDefaultPassword() {
- return DEFAULT_JDBC_PASSWORD;
- }
-
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java
deleted file mode 100644
index 0131c28cb9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.context.persistence.connection;
-
-import java.util.Map;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0;
-
-/**
- * GenericConnection2_0
- */
-public class NullConnection2_0 extends AbstractPersistenceUnitProperties
- implements JpaConnection2_0
-{
-
-
- // ********** constructors **********
- public NullConnection2_0(PersistenceUnit parent) {
- super(parent);
- }
-
- // ********** initialization **********
- /**
- * Initializes properties with values from the persistence unit.
- */
- @Override
- protected void initializeProperties() {
- //do nothing
- }
-
- // ********** behavior **********
-
- public void propertyValueChanged(String propertyName, String newValue) {
- //do nothing
- }
-
- public void propertyRemoved(String propertyName) {
- //do nothing
- }
-
- /**
- * Adds property names key/value pairs, where:
- * key = PU property key
- * value = property id
- */
- @Override
- protected void addPropertyNames(Map<String, String> propertyNames) {
- //do nothing
- }
-
- // ********** Driver **********
- public String getDriver() {
- return null;
- }
-
- public void setDriver(String newDriver) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultDriver() {
- return DEFAULT_JDBC_DRIVER;
- }
-
- // ********** URL **********
- public String getUrl() {
- return null;
- }
-
- public void setUrl(String newUrl) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultUrl() {
- return DEFAULT_JDBC_URL;
- }
-
- // ********** User **********
- public String getUser() {
- return null;
- }
-
- public void setUser(String newUser) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultUser() {
- return DEFAULT_JDBC_USER;
- }
-
- // ********** Password **********
- public String getPassword() {
- return null;
- }
-
- public void setPassword(String newPassword) {
- throw new UnsupportedOperationException();
- }
-
- public String getDefaultPassword() {
- return DEFAULT_JDBC_PASSWORD;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java
deleted file mode 100644
index 48cf290337..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java
+++ /dev/null
@@ -1,333 +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.jpa.core.internal.jpa2.context.persistence.options;
-
-import java.util.List;
-import java.util.Map;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0;
-
-/**
- * JPA 2.0 options
- */
-public class GenericOptions2_0 extends AbstractPersistenceUnitProperties
- implements JpaOptions2_0
-{
- // ********** GenericConnection properties **********
- private Integer lockTimeout;
- private Integer queryTimeout;
- private List<String> validationGroupPrePersists;
- private List<String> validationGroupPreUpdates;
- private List<String> validationGroupPreRemoves;
-
- // ********** constructors **********
- public GenericOptions2_0(PersistenceUnit parent) {
- super(parent);
- }
-
- // ********** initialization **********
- /**
- * Initializes properties with values from the persistence unit.
- */
- @Override
- protected void initializeProperties() {
- this.lockTimeout =
- this.getIntegerValue(PERSISTENCE_LOCK_TIMEOUT);
- this.queryTimeout =
- this.getIntegerValue(PERSISTENCE_QUERY_TIMEOUT);
-
- // ValidationMode is initialized with the persistence unit element
- this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST);
- this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE);
- this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE);
- }
-
- // ********** behavior **********
-
- public void propertyValueChanged(String propertyName, String newValue) {
- if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) {
- this.lockTimeoutChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) {
- this.queryTimeoutChanged(newValue);
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) {
- this.validationGroupPrePersistsChanged();
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) {
- this.validationGroupPreUpdatesChanged();
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) {
- this.validationGroupPreRemovesChanged();
- }
- }
-
- public void propertyRemoved(String propertyName) {
- if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) {
- this.lockTimeoutChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) {
- this.queryTimeoutChanged(null);
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) {
- this.validationGroupPrePersistsChanged();
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) {
- this.validationGroupPreUpdatesChanged();
- }
- else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) {
- this.validationGroupPreRemovesChanged();
- }
- }
-
- /**
- * Adds property names key/value pairs, where:
- * key = PU property key
- * value = property id
- */
- @Override
- protected void addPropertyNames(Map<String, String> propertyNames) {
- propertyNames.put(
- PERSISTENCE_LOCK_TIMEOUT,
- LOCK_TIMEOUT_PROPERTY);
- propertyNames.put(
- PERSISTENCE_QUERY_TIMEOUT,
- QUERY_TIMEOUT_PROPERTY);
- propertyNames.put(
- PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST,
- VALIDATION_GROUP_PRE_PERSIST_PROPERTY);
- propertyNames.put(
- PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE,
- VALIDATION_GROUP_PRE_UPDATE_PROPERTY);
- propertyNames.put(
- PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE,
- VALIDATION_GROUP_PRE_REMOVE_PROPERTY);
- }
-
- @Override
- public PersistenceUnit2_0 getPersistenceUnit() {
- return (PersistenceUnit2_0) super.getPersistenceUnit();
- }
-
- // ********** LockTimeout **********
- public Integer getLockTimeout() {
- return this.lockTimeout;
- }
-
- public void setLockTimeout(Integer newLockTimeout) {
- Integer old = this.lockTimeout;
- this.lockTimeout = newLockTimeout;
- this.putProperty(LOCK_TIMEOUT_PROPERTY, newLockTimeout);
- this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newLockTimeout);
- }
-
- private void lockTimeoutChanged(String stringValue) {
- Integer newValue = getIntegerValueOf(stringValue);
-
- Integer old = this.lockTimeout;
- this.lockTimeout = newValue;
- this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newValue);
- }
-
- public Integer getDefaultLockTimeout() {
- return DEFAULT_LOCK_TIMEOUT;
- }
-
- // ********** QueryTimeout **********
- public Integer getQueryTimeout() {
- return this.queryTimeout;
- }
-
- public void setQueryTimeout(Integer newQueryTimeout) {
- Integer old = this.queryTimeout;
- this.queryTimeout = newQueryTimeout;
- this.putProperty(QUERY_TIMEOUT_PROPERTY, newQueryTimeout);
- this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newQueryTimeout);
- }
-
- private void queryTimeoutChanged(String stringValue) {
- Integer newValue = getIntegerValueOf(stringValue);
-
- Integer old = this.queryTimeout;
- this.queryTimeout = newValue;
- this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newValue);
- }
-
- public Integer getDefaultQueryTimeout() {
- return DEFAULT_QUERY_TIMEOUT;
- }
-
- // ********** ValidationGroupPrePersists **********
- public ListIterable<String> getValidationGroupPrePersists(){
- return new LiveCloneListIterable<String>(this.validationGroupPrePersists);
- }
-
- public int getValidationGroupPrePersistsSize(){
- 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 ( String validationGroupPrePersist : this.getValidationGroupPrePersists()) {
- 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 ListIterable<String> getValidationGroupPreUpdates(){
- return new LiveCloneListIterable<String>(this.validationGroupPreUpdates);
- }
-
- public int getValidationGroupPreUpdatesSize(){
- 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(String validationGroupPreUpdate : this.getValidationGroupPreUpdates()) {
- 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 ListIterable<String> getValidationGroupPreRemoves(){
- return new LiveCloneListIterable<String>(this.validationGroupPreRemoves);
- }
-
- public int getValidationGroupPreRemovesSize(){
- 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(String validationGroupPreRemove : this.getValidationGroupPreRemoves()) {
- if(validationGroupPreRemove.equals(className)) {
- this.validationGroupPreRemoves.remove(validationGroupPreRemove);
- return validationGroupPreRemove;
- }
- }
- return null;
- }
-
- private void validationGroupPreRemovesChanged() {
- this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE);
- this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
deleted file mode 100644
index 4ef13a055e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java
+++ /dev/null
@@ -1,151 +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.jpa.core.internal.jpa2.context.persistence.options;
-
-import java.util.Map;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0;
-
-/**
- * JPA 2.0 options
- */
-public class NullOptions2_0 extends AbstractPersistenceUnitProperties
- implements JpaOptions2_0
-{
-
-
- // ********** constructors **********
- public NullOptions2_0(PersistenceUnit parent) {
- super(parent);
- }
-
- // ********** initialization **********
- /**
- * Initializes properties with values from the persistence unit.
- */
- @Override
- protected void initializeProperties() {
- //do nothing
- }
-
- // ********** behavior **********
-
- public void propertyValueChanged(String propertyName, String newValue) {
- //do nothing
- }
-
- public void propertyRemoved(String propertyName) {
- //do nothing
- }
-
- /**
- * Adds property names key/value pairs, where:
- * key = PU property key
- * value = property id
- */
- @Override
- protected void addPropertyNames(Map<String, String> propertyNames) {
- //do nothing
- }
-
- // ********** LockTimeout **********
- public Integer getLockTimeout() {
- return null;
- }
-
- public void setLockTimeout(Integer newLockTimeout) {
- throw new UnsupportedOperationException();
- }
-
- public Integer getDefaultLockTimeout() {
- return DEFAULT_LOCK_TIMEOUT;
- }
-
- // ********** QueryTimeout **********
- public Integer getQueryTimeout() {
- return null;
- }
-
- public void setQueryTimeout(Integer newQueryTimeout) {
- throw new UnsupportedOperationException();
- }
-
- public Integer getDefaultQueryTimeout() {
- return DEFAULT_QUERY_TIMEOUT;
- }
-
-
- // ********** ValidationGroupPrePersists **********
- public ListIterable<String> getValidationGroupPrePersists() {
- return EmptyListIterable.instance();
- }
-
- public int getValidationGroupPrePersistsSize() {
- 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 ListIterable<String> getValidationGroupPreUpdates() {
- return EmptyListIterable.instance();
- }
-
- public int getValidationGroupPreUpdatesSize() {
- 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 ListIterable<String> getValidationGroupPreRemoves() {
- return EmptyListIterable.instance();
- }
-
- public int getValidationGroupPreRemovesSize() {
- return 0;
- }
-
- public boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName) {
- return false;
- }
-
- public String addValidationGroupPreRemove(String newValidationGroupPreRemoveClassName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeValidationGroupPreRemove(String validationGroupPreRemoveClassName) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
deleted file mode 100644
index 86549e3f5c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAccess2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAccess2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullAccess2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryAccess2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return Access2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java
deleted file mode 100644
index c6af80ab76..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverride2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverride2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public final class AssociationOverride2_0AnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new AssociationOverride2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AssociationOverride2_0AnnotationDefinition() {
- super();
- }
-
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceAssociationOverride2_0Annotation.buildSourceAssociationOverrideAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryAssociationOverride2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.ASSOCIATION_OVERRIDE;
- }
-
- public String getContainerAnnotationName() {
- return JPA.ASSOCIATION_OVERRIDES;
- }
-
- public String getElementName() {
- return JPA.ASSOCIATION_OVERRIDES__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
deleted file mode 100644
index b46f96c619..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCacheable2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCacheable2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryCacheable2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return Cacheable2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
deleted file mode 100644
index d898e2e2bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCollectionTable2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCollectionTable2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullCollectionTable2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryCollectionTable2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return CollectionTable2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
deleted file mode 100644
index 1606cb9293..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryElementCollection2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceElementCollection2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryElementCollection2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ElementCollection2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
deleted file mode 100644
index 347b781d01..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java
+++ /dev/null
@@ -1,58 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryGeneratedAnnotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceGeneratedAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-
-/**
- * javax.annotation.Generated
- */
-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(parent, annotatedElement);
- }
-
- public GeneratedAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryGeneratedAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return GeneratedAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
deleted file mode 100644
index 2b6168c2ec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyClass2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyClass2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapKeyClass2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
deleted file mode 100644
index 9cb89d9c70..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullMapKeyColumnAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyColumn2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapKeyColumn2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
deleted file mode 100644
index f529e3baa5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullMapKeyEnumerated2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyEnumerated2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
deleted file mode 100644
index 94d71a1a50..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyJoinColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-
-/**
- * javax.persistence.MapKeyJoinColumn
- */
-public final class MapKeyJoinColumn2_0AnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new MapKeyJoinColumn2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private MapKeyJoinColumn2_0AnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceMapKeyJoinColumn2_0Annotation.buildSourceMapKeyJoinColumnAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryMapKeyJoinColumn2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN;
- }
-
- public String getContainerAnnotationName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMNS;
- }
-
- public String getElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
deleted file mode 100644
index 34b7b7c09b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-
-/**
- * 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 Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
- }
-
- public String getAnnotationName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMNS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
deleted file mode 100644
index 7275995d17..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 201 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullMapKeyTemporal2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyTemporal2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapKeyTemporal2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
deleted file mode 100644
index 2f4c550557..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,62 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapsId2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullMapsId2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapsId2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapsId2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
deleted file mode 100644
index 1890065719..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQuery2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQuery2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.NamedQuery
- */
-public class NamedQuery2_0AnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new NamedQuery2_0AnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NamedQuery2_0AnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceNamedQuery2_0Annotation.buildSourceNamedQueryAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryNamedQuery2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.NAMED_QUERY;
- }
-
- public String getContainerAnnotationName() {
- return JPA.NAMED_QUERIES;
- }
-
- public String getElementName() {
- return JPA.NAMED_QUERIES__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
deleted file mode 100644
index 2e79bebb33..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java
+++ /dev/null
@@ -1,50 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-
-/**
- * <code>javax.persistence.Access</code>
- */
-public final class NullAccess2_0Annotation
- extends NullAnnotation<Access2_0Annotation>
- implements Access2_0Annotation
-{
-
- protected NullAccess2_0Annotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** value
- public AccessType getValue() {
- return null;
- }
-
- public void setValue(AccessType value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java
deleted file mode 100644
index 2393ed2dd2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-
-/**
- * <code>javax.persistence.JoinTable</code> found in a
- * <code>javax.persistence.AssociationOverride</code> annotation
- */
-public final class NullAssociationOverrideJoinTableAnnotation
- extends NullJoinTableAnnotation
-{
- public NullAssociationOverrideJoinTableAnnotation(AssociationOverride2_0Annotation parent) {
- super(parent);
- }
-
- private AssociationOverride2_0Annotation getAssociationOverride2_0Annotation() {
- return (AssociationOverride2_0Annotation) this.parent;
- }
-
- @Override
- protected JoinTableAnnotation addAnnotation() {
- return this.getAssociationOverride2_0Annotation().addJoinTable();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
deleted file mode 100644
index 8d92f4a687..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-
-/**
- * <code>javax.persistence.CollectionTable</code>
- */
-public final class NullCollectionTable2_0Annotation
- extends NullBaseTableAnnotation<CollectionTable2_0Annotation>
- implements CollectionTable2_0Annotation
-{
- public NullCollectionTable2_0Annotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** join columns
- public ListIterable<JoinColumnAnnotation> getJoinColumns() {
- return EmptyListIterable.instance();
- }
-
- public int getJoinColumnsSize() {
- return 0;
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return null;
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- // the CollectionTable annotation is missing, add both it and a join column at the same time
- return this.addAnnotation().addJoinColumn(index);
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
deleted file mode 100644
index 7eac37b7ea..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java
+++ /dev/null
@@ -1,77 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-
-/**
- * <code>javax.persistence.MapKeyColumn</code>
- */
-public final class NullMapKeyColumnAnnotation
- extends NullBaseColumnAnnotation<MapKeyColumn2_0Annotation>
- implements MapKeyColumn2_0Annotation
-{
- public NullMapKeyColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** length
- public Integer getLength() {
- return null;
- }
-
- public void setLength(Integer length) {
- if (length != null) {
- this.addAnnotation().setLength(length);
- }
- }
-
- public TextRange getLengthTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** scale
- public Integer getScale() {
- return null;
- }
-
- public void setScale(Integer scale) {
- if (scale != null) {
- this.addAnnotation().setScale(scale);
- }
- }
-
- public TextRange getScaleTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** precision
- public Integer getPrecision() {
- return null;
- }
-
- public void setPrecision(Integer precision) {
- if (precision != null) {
- this.addAnnotation().setPrecision(precision);
- }
- }
-
- public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
deleted file mode 100644
index 62d1125de5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java
+++ /dev/null
@@ -1,48 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.EnumType;
-
-/**
- * <code>javax.persistence.MapKeyEnumerated</code>
- */
-public final class NullMapKeyEnumerated2_0Annotation
- extends NullAnnotation<MapKeyEnumerated2_0Annotation>
- implements MapKeyEnumerated2_0Annotation
-{
- protected NullMapKeyEnumerated2_0Annotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** value
- public EnumType getValue() {
- return null;
- }
-
- public void setValue(EnumType value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
deleted file mode 100644
index 25971b4410..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java
+++ /dev/null
@@ -1,48 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
-
-/**
- * <code>javax.persistence.MapKeyTemporal</code>
- */
-public final class NullMapKeyTemporal2_0Annotation
- extends NullAnnotation<MapKeyTemporal2_0Annotation>
- implements MapKeyTemporal2_0Annotation
-{
- protected NullMapKeyTemporal2_0Annotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** value
- public TemporalType getValue() {
- return null;
- }
-
- public void setValue(TemporalType value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
deleted file mode 100644
index 89553a2ed0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java
+++ /dev/null
@@ -1,51 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-
-/**
- * <code>javax.persistence.MapsId</code>
- */
-public final class NullMapsId2_0Annotation
- extends NullAnnotation<MapsId2_0Annotation>
- implements MapsId2_0Annotation
-{
- protected NullMapsId2_0Annotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** value
- public String getValue() {
- return null;
- }
-
- public void setValue(String newValue) {
- if (newValue != null) {
- this.addAnnotation().setValue(newValue);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean valueTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
deleted file mode 100644
index c74886dec1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java
+++ /dev/null
@@ -1,77 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullNamedColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-
-/**
- * <code>javax.persistence.OrderColumn</code>
- */
-public final class NullOrderColumn2_0Annotation
- extends NullNamedColumnAnnotation<OrderColumn2_0Annotation>
- implements OrderColumn2_0Annotation
-{
- public NullOrderColumn2_0Annotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** updatable
- public Boolean getUpdatable() {
- return null;
- }
-
- public void setUpdatable(Boolean updatable) {
- if (updatable != null) {
- this.addAnnotation().setUpdatable(updatable);
- }
- }
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** insertable
- public Boolean getInsertable() {
- return null;
- }
-
- public void setInsertable(Boolean insertable) {
- if (insertable != null) {
- this.addAnnotation().setInsertable(insertable);
- }
- }
-
- public TextRange getInsertableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** nullable
- public Boolean getNullable() {
- return null;
- }
-
- public void setNullable(Boolean nullable) {
- if (nullable != null) {
- this.addAnnotation().setNullable(nullable);
- }
- }
-
- public TextRange getNullableTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
deleted file mode 100644
index d43bcb3c79..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryOrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceOrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullOrderColumn2_0Annotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryOrderColumn2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OrderColumn2_0Annotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
deleted file mode 100644
index 780423fae5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinarySequenceGenerator2_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceSequenceGenerator2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinarySequenceGenerator2_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return SequenceGeneratorAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
deleted file mode 100644
index 78cd576c44..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java
+++ /dev/null
@@ -1,58 +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.jpa.core.internal.jpa2.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryStaticMetamodelAnnotation;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceStaticMetamodelAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
-
-/**
- * javax.persistence.metamodel.StaticMetamodel
- */
-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(parent, annotatedElement);
- }
-
- public StaticMetamodelAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryStaticMetamodelAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return StaticMetamodelAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
deleted file mode 100644
index cf8d13cf81..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java
+++ /dev/null
@@ -1,77 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-
-/**
- * javax.persistence.Access
- */
-public final class BinaryAccess2_0Annotation
- extends BinaryAnnotation
- implements Access2_0Annotation
-{
- private AccessType value;
-
-
- public BinaryAccess2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** AccessAnnotation implementation **********
-
- // ***** value
- public AccessType getValue() {
- return this.value;
- }
-
- public void setValue(AccessType value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(AccessType value) {
- AccessType old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private AccessType buildValue() {
- return AccessType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ACCESS));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
deleted file mode 100644
index ea89f2b714..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java
+++ /dev/null
@@ -1,95 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-
-/**
- * BinarySequenceGenerator2_0Annotation
- */
-public final class BinaryAssociationOverride2_0Annotation
- extends BinaryAssociationOverrideAnnotation
- implements AssociationOverride2_0Annotation
-{
- private JoinTableAnnotation joinTable;
- private final JoinTableAnnotation nullJoinTable;
-
- public BinaryAssociationOverride2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.joinTable = this.buildJoinTable();
- this.nullJoinTable = this.buildNullJoinTable();
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJoinTable();
- }
-
-
- // ********** AssociationOverride2_0Annotation implementation **********
-
- // ***** joinTable
- public JoinTableAnnotation getJoinTable() {
- return this.joinTable;
- }
-
- public JoinTableAnnotation getNonNullJoinTable() {
- return (this.joinTable != null) ? this.joinTable : this.nullJoinTable;
- }
-
- public JoinTableAnnotation addJoinTable() {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinTable() {
- throw new UnsupportedOperationException();
- }
-
- private JoinTableAnnotation buildJoinTable() {
- IAnnotation jdtJoinTable = this.getJdtJoinTable();
- return (jdtJoinTable == null) ? null : this.buildJoinTable(jdtJoinTable);
- }
-
- private JoinTableAnnotation buildNullJoinTable() {
- return new NullJoinTableAnnotation(this);
- }
-
- private JoinTableAnnotation buildJoinTable(IAnnotation jdtJoinTable) {
- return new BinaryJoinTableAnnotation(this, jdtJoinTable);
- }
-
- private IAnnotation getJdtJoinTable() {
- return (IAnnotation) this.getJdtMemberValue(JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE);
- }
-
- // TODO
- private void updateJoinTable() {
- throw new UnsupportedOperationException();
-// IAnnotation jdtJoinTable = this.getJdtJoinTable();
-// if (jdtJoinTable == null) {
-// this.setJoinTable(null);
-// } else {
-// if (this.column == null) {
-// this.setJoinTable(this.buildJoinTable(jdtJoinTable));
-// } else {
-// this.column.update(jdtJoinTable);
-// }
-// }
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
deleted file mode 100644
index aa1a5d0219..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java
+++ /dev/null
@@ -1,70 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-
-/**
- * javax.persistence.Cacheable
- */
-public final class BinaryCacheable2_0Annotation
- extends BinaryAnnotation
- implements Cacheable2_0Annotation
-{
- private Boolean value;
-
-
- public BinaryCacheable2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** Cacheable2_0Annotation implementation **********
-
- // ***** value
- public Boolean getValue() {
- return this.value;
- }
-
- public void setValue(Boolean value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(Boolean value) {
- Boolean old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private Boolean buildValue() {
- return (Boolean) this.getJdtMemberValue(JPA2_0.CACHEABLE__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
deleted file mode 100644
index 00024b61cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java
+++ /dev/null
@@ -1,113 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-
-/**
- * javax.persistence.CollectionTable
- */
-public final class BinaryCollectionTable2_0Annotation
- extends BinaryBaseTableAnnotation
- implements CollectionTable2_0Annotation
-{
- private final Vector<JoinColumnAnnotation> joinColumns;
-
-
- public BinaryCollectionTable2_0Annotation(JavaResourceAnnotatedElement 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 ListIterable<JoinColumnAnnotation> getJoinColumns() {
- return new LiveCloneListIterable<JoinColumnAnnotation>(this.joinColumns);
- }
-
- public int getJoinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<JoinColumnAnnotation> buildJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS);
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- // TODO
- private void updateJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java
deleted file mode 100644
index 256fa2a562..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-
-/**
- * org.eclipse.persistence.annotations.Transformation
- */
-public class BinaryElementCollection2_0Annotation
- extends BinaryAnnotation
- implements ElementCollection2_0Annotation
-{
- private String targetClass;
- private FetchType fetch;
-
-
- public BinaryElementCollection2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.targetClass = this.buildTargetClass();
- this.fetch = this.buildFetch();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setTargetClass_(this.buildTargetClass());
- this.setFetch_(this.buildFetch());
- }
-
-
- // ********** ElementCollection2_0Annotation implementation **********
-
- // ***** target entity
- public String getTargetClass() {
- return this.targetClass;
- }
-
- public void setTargetClass(String targetClass) {
- throw new UnsupportedOperationException();
- }
-
- private void setTargetClass_(String targetClass) {
- String old = this.targetClass;
- this.targetClass = targetClass;
- this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, targetClass);
- }
-
- private String buildTargetClass() {
- return (String) this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS);
- }
-
- public TextRange getTargetClassTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fully-qualified target entity class name
- public String getFullyQualifiedTargetClassName() {
- return this.targetClass;
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- throw new UnsupportedOperationException();
- }
-
- private void setFetch_(FetchType fetch) {
- FetchType old = this.fetch;
- this.fetch = fetch;
- this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
- }
-
- private FetchType buildFetch() {
- return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__FETCH));
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
deleted file mode 100644
index a8427a3af8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java
+++ /dev/null
@@ -1,139 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-
-/**
- * javax.annotation.Generated
- */
-public final class BinaryGeneratedAnnotation
- extends BinaryAnnotation
- implements GeneratedAnnotation
-{
- private final Vector<String> values;
- private String date;
- private String comments;
-
-
- public BinaryGeneratedAnnotation(JavaResourceAnnotatedElement 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 ListIterable<String> getValues() {
- return new LiveCloneListIterable<String>(this.values);
- }
-
- public int getValuesSize() {
- return this.values.size();
- }
-
- public String getValue(int index) {
- return this.values.get(index);
- }
-
- private Vector<String> buildValues() {
- Object[] jdtValues = this.getJdtMemberValues(VALUE_ELEMENT_NAME);
- Vector<String> result = new Vector<String>(jdtValues.length);
- for (Object value : jdtValues) {
- result.add((String) value);
- }
- return result;
- }
-
- public void addValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- public void addValue(int index, String value) {
- throw new UnsupportedOperationException();
- }
-
- public void moveValue(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- public void removeValue(int index) {
- throw new UnsupportedOperationException();
- }
-
- // ***** date
- public String getDate() {
- return this.date;
- }
-
- public void setDate(String date) {
- throw new UnsupportedOperationException();
- }
-
- private void setDate_(String date) {
- String old = this.date;
- this.date = date;
- this.firePropertyChanged(DATE_PROPERTY, old, date);
- }
-
- private String buildDate() {
- return (String) this.getJdtMemberValue(DATE_ELEMENT_NAME);
- }
-
- // ***** comments
- public String getComments() {
- return this.comments;
- }
-
- public void setComments(String comments) {
- throw new UnsupportedOperationException();
- }
-
- private void setComments_(String comments) {
- String old = this.comments;
- this.comments = comments;
- this.firePropertyChanged(COMMENTS_PROPERTY, old, comments);
- }
-
- private String buildComments() {
- return (String) this.getJdtMemberValue(COMMENTS_ELEMENT_NAME);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
deleted file mode 100644
index 591ebbb90c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java
+++ /dev/null
@@ -1,79 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-
-/**
- * javax.persistence.MapKeyClass
- */
-public final class BinaryMapKeyClass2_0Annotation
- extends BinaryAnnotation
- implements MapKeyClass2_0Annotation
-{
- private String value;
-
-
- public BinaryMapKeyClass2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** MapKeyClass2_0Annotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA2_0.MAP_KEY_CLASS__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fully-qualified class name
- /**
- * binary is already fully-qualified
- */
- public String getFullyQualifiedClassName() {
- return this.value;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
deleted file mode 100644
index 751e2a04b2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java
+++ /dev/null
@@ -1,92 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryCompleteColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-
-/**
- * javax.persistence.MapKeyColumn
- */
-public final class BinaryMapKeyColumn2_0Annotation
- extends BinaryCompleteColumnAnnotation
- implements MapKeyColumn2_0Annotation
-{
-
- public BinaryMapKeyColumn2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** BinaryNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA2_0.MAP_KEY_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA2_0.MAP_KEY_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** BinaryBaseColumnAnnotation implementation **********
-
- @Override
- protected String getTableElementName() {
- return JPA2_0.MAP_KEY_COLUMN__TABLE;
- }
-
- @Override
- protected String getUniqueElementName() {
- return JPA2_0.MAP_KEY_COLUMN__UNIQUE;
- }
-
- @Override
- protected String getNullableElementName() {
- return JPA2_0.MAP_KEY_COLUMN__NULLABLE;
- }
-
- @Override
- protected String getInsertableElementName() {
- return JPA2_0.MAP_KEY_COLUMN__INSERTABLE;
- }
-
- @Override
- protected String getUpdatableElementName() {
- return JPA2_0.MAP_KEY_COLUMN__UPDATABLE;
- }
-
-
- // ********** BinaryCompleteColumnAnnotation implementation **********
-
- @Override
- protected String getLengthElementName() {
- return JPA2_0.MAP_KEY_COLUMN__LENGTH;
- }
-
- @Override
- protected String getPrecisionElementName() {
- return JPA2_0.MAP_KEY_COLUMN__PRECISION;
- }
-
- @Override
- protected String getScaleElementName() {
- return JPA2_0.MAP_KEY_COLUMN__SCALE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
deleted file mode 100644
index 5c838e012b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java
+++ /dev/null
@@ -1,38 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseEnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-
-/**
- * javax.persistence.MapKeyEnumerated
- */
-public final class BinaryMapKeyEnumerated2_0Annotation
- extends BinaryBaseEnumeratedAnnotation
- implements MapKeyEnumerated2_0Annotation
-{
-
- public BinaryMapKeyEnumerated2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME;
- }
-
- @Override
- protected String getValueElementName() {
- return JPA2_0.MAP_KEY_ENUMERATED__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
deleted file mode 100644
index 9a088faadc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java
+++ /dev/null
@@ -1,83 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-
-/**
- * javax.persistence.MapKeyJoinColumn
- */
-public final class BinaryMapKeyJoinColumn2_0Annotation
- extends BinaryBaseJoinColumnAnnotation
- implements MapKeyJoinColumn2_0Annotation
-{
-
- public BinaryMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** BinaryNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** BinaryBaseColumnAnnotation implementation **********
-
- @Override
- protected String getTableElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE;
- }
-
- @Override
- protected String getUniqueElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE;
- }
-
- @Override
- protected String getNullableElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE;
- }
-
- @Override
- protected String getInsertableElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE;
- }
-
- @Override
- protected String getUpdatableElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE;
- }
-
-
- // ********** BinaryBaseJoinColumnAnnotation implementation **********
-
- @Override
- protected String getReferencedColumnNameElementName() {
- return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
deleted file mode 100644
index 72ff920a1c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java
+++ /dev/null
@@ -1,38 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTemporalAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-
-/**
- * javax.persistence.MapKeyTemporal
- */
-public final class BinaryMapKeyTemporal2_0Annotation
- extends BinaryBaseTemporalAnnotation
- implements MapKeyTemporal2_0Annotation
-{
-
- public BinaryMapKeyTemporal2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapKeyTemporal2_0Annotation.ANNOTATION_NAME;
- }
-
- @Override
- protected String getValueElementName() {
- return JPA2_0.MAP_KEY_TEMPORAL__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
deleted file mode 100644
index c3b700c917..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java
+++ /dev/null
@@ -1,80 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-
-/**
- * javax.persistence.MapsId
- */
-public class BinaryMapsId2_0Annotation
- extends BinaryAnnotation
- implements MapsId2_0Annotation
-{
- private String value;
-
-
- public BinaryMapsId2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** MapsId2_0Annotation implementation **********
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String newValue) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String newValue) {
- String oldValue = this.value;
- this.value = newValue;
- this.firePropertyChanged(VALUE_PROPERTY, oldValue, newValue);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA2_0.MAPS_ID__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean valueTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
deleted file mode 100644
index baf9d643a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java
+++ /dev/null
@@ -1,69 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
-
-/**
- * BinaryNamedQuery2_0Annotation
- */
-public final class BinaryNamedQuery2_0Annotation
- extends BinaryNamedQueryAnnotation
- implements NamedQuery2_0Annotation
-{
- private LockModeType_2_0 lockMode;
-
- public BinaryNamedQuery2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.lockMode = this.buildLockMode();
- }
-
- @Override
- public void update() {
- super.update();
- this.setLockMode_(this.buildLockMode());
- }
-
- // ********** NamedQuery2_0Annotation implementation **********
-
- public LockModeType_2_0 getLockMode() {
- return this.lockMode;
- }
-
- public void setLockMode(LockModeType_2_0 lockMode) {
- throw new UnsupportedOperationException();
- }
-
- private void setLockMode_(LockModeType_2_0 lockMode) {
- LockModeType_2_0 old = this.lockMode;
- this.lockMode = lockMode;
- this.firePropertyChanged(LOCK_MODE_PROPERTY, old, lockMode);
- }
-
- public TextRange getLockModeTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean lockModeTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- private LockModeType_2_0 buildLockMode() {
- return LockModeType_2_0.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.NAMED_QUERY__LOCK_MODE));
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
deleted file mode 100644
index a7ecfee5bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java
+++ /dev/null
@@ -1,147 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.OrderColumn
- */
-public class BinaryOrderColumn2_0Annotation
- extends BinaryNamedColumnAnnotation
- implements OrderColumn2_0Annotation
-{
- private Boolean nullable;
- private Boolean insertable;
- private Boolean updatable;
-
-
- public BinaryOrderColumn2_0Annotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.nullable = this.buildNullable();
- this.insertable = this.buildInsertable();
- this.updatable = this.buildUpdatable();
- }
-
- @Override
- public void update() {
- super.update();
- this.setNullable_(this.buildNullable());
- this.setInsertable_(this.buildInsertable());
- this.setUpdatable_(this.buildUpdatable());
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- //************* BinaryNamedColumnAnnotation implementation *************
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.COLUMN__COLUMN_DEFINITION;
- }
-
- @Override
- protected String getNameElementName() {
- return JPA.COLUMN__NAME;
- }
-
- //************* OrderColumn2_0Annotation implementation *************
-
- // ***** nullable
- public Boolean getNullable() {
- return this.nullable;
- }
-
- public void setNullable(Boolean nullable) {
- throw new UnsupportedOperationException();
- }
-
- private void setNullable_(Boolean nullable) {
- Boolean old = this.nullable;
- this.nullable = nullable;
- this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable);
- }
-
- private Boolean buildNullable() {
- return (Boolean) this.getJdtMemberValue(getNullableElementName());
- }
-
- String getNullableElementName() {
- return JPA.COLUMN__NULLABLE;
- }
-
- public TextRange getNullableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** insertable
- public Boolean getInsertable() {
- return this.insertable;
- }
-
- public void setInsertable(Boolean insertable) {
- throw new UnsupportedOperationException();
- }
-
- private void setInsertable_(Boolean insertable) {
- Boolean old = this.insertable;
- this.insertable = insertable;
- this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable);
- }
-
- private Boolean buildInsertable() {
- return (Boolean) this.getJdtMemberValue(this.getInsertableElementName());
- }
-
- String getInsertableElementName() {
- return JPA.COLUMN__INSERTABLE;
- }
-
- public TextRange getInsertableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** updatable
- public Boolean getUpdatable() {
- return this.updatable;
- }
-
- public void setUpdatable(Boolean updatable) {
- throw new UnsupportedOperationException();
- }
-
- private void setUpdatable_(Boolean updatable) {
- Boolean old = this.updatable;
- this.updatable = updatable;
- this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable);
- }
-
- private Boolean buildUpdatable() {
- return (Boolean) this.getJdtMemberValue(this.getUpdatableElementName());
- }
-
- String getUpdatableElementName() {
- return JPA.COLUMN__UPDATABLE;
- }
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java
deleted file mode 100644
index 9ccb8ee0a9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-
-/**
- * BinarySequenceGenerator2_0Annotation
- */
-public final class BinarySequenceGenerator2_0Annotation
- extends BinarySequenceGeneratorAnnotation
- implements SequenceGenerator2_0Annotation
-{
- private String catalog;
- private String schema;
-
-
- public BinarySequenceGenerator2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.catalog = this.buildCatalog();
- this.schema = this.buildSchema();
- }
-
- @Override
- public void update() {
- super.update();
- this.setCatalog_(this.buildCatalog());
- this.setSchema_(this.buildSchema());
- }
-
- // ********** SequenceGenerator2_0Annotation implementation **********
-
- // ********** catalog **********
-
- public String getCatalog() {
- return this.catalog;
- }
-
- public void setCatalog(String catalog) {
- throw new UnsupportedOperationException();
- }
-
- private void setCatalog_(String catalog) {
- String old = this.catalog;
- this.catalog = catalog;
- this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
- }
-
- private String buildCatalog() {
- return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__CATALOG);
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ********** schema **********
-
- public String getSchema() {
- return this.schema;
- }
-
- public void setSchema(String schema) {
- throw new UnsupportedOperationException();
- }
-
- private void setSchema_(String schema) {
- String old = this.schema;
- this.schema = schema;
- this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
- }
-
- private String buildSchema() {
- return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__SCHEMA);
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
deleted file mode 100644
index 417f94a781..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java
+++ /dev/null
@@ -1,73 +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.jpa.core.internal.jpa2.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
-
-/**
- * javax.persistence.metamodel.StaticMetamodel
- */
-public final class BinaryStaticMetamodelAnnotation
- extends BinaryAnnotation
- implements StaticMetamodelAnnotation
-{
- private String value;
-
-
- public BinaryStaticMetamodelAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** StaticMetamodelAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA2_0.STATIC_METAMODEL__VALUE);
- }
-
- // ***** fully-qualified class name
- /**
- * binary is already fully-qualified
- */
- public String getFullyQualifiedClassName() {
- return this.value;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
deleted file mode 100644
index 15375658fc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java
+++ /dev/null
@@ -1,104 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.AccessType;
-
-/**
- * javax.persistence.Access
- */
-public final class SourceAccess2_0Annotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** AccessAnnotation implementation **********
-
- // ***** value
- public AccessType getValue() {
- return this.value;
- }
-
- public void setValue(AccessType value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.valueAdapter.setValue(AccessType.toJavaAnnotationValue(value));
- }
- }
-
- private void syncValue(AccessType astValue) {
- AccessType old = this.value;
- this.value = astValue;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private AccessType buildValue(CompilationUnit astRoot) {
- return AccessType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ACCESS__VALUE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
deleted file mode 100644
index cf1e98cdcf..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java
+++ /dev/null
@@ -1,185 +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.jpa.core.internal.jpa2.resource.java.source;
-
-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.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NullAssociationOverrideJoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.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 static SourceAssociationOverride2_0Annotation buildSourceAssociationOverrideAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element) {
-
- return new SourceAssociationOverride2_0Annotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public static SourceAssociationOverride2_0Annotation buildSourceAssociationOverrideAnnotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement annotatedElement,
- int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildAssociationOverrideDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildAssociationOverrideAnnotationAdapter(annotatedElement, idaa);
- return new SourceAssociationOverride2_0Annotation(
- parent,
- annotatedElement,
- idaa,
- iaa);
- }
-
- public static SourceAssociationOverride2_0Annotation buildNestedSourceAssociationOverrideAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- return new SourceAssociationOverride2_0Annotation(parent, element, idaa);
- }
-
- private SourceAssociationOverride2_0Annotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- DeclarationAnnotationAdapter daa) {
-
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- private SourceAssociationOverride2_0Annotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
- }
-
- private SourceAssociationOverride2_0Annotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, 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);
- }
-
-
- // ********** static methods **********
-
- static JoinTableAnnotation buildJoinTableAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
- return new SourceJoinTableAnnotation(parent, element, buildJoinTableAnnotationAdapter(associationOverrideAnnotationAdapter));
- }
-
- static DeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) {
- return new NestedDeclarationAnnotationAdapter(associationOverrideAnnotationAdapter, JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE, JPA.JOIN_TABLE);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
deleted file mode 100644
index 50ebc6ee75..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java
+++ /dev/null
@@ -1,104 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-
-/**
- * javax.persistence.Cacheable
- */
-public final class SourceCacheable2_0Annotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** Cacheable2_0Annotation implementation **********
-
- // ***** value
- public Boolean getValue() {
- return this.value;
- }
-
- public void setValue(Boolean value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.valueAdapter.setValue(value);
- }
- }
-
- private void syncValue(Boolean astValue) {
- Boolean old = this.value;
- this.value = astValue;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private Boolean buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.CACHEABLE__VALUE, BooleanExpressionConverter.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
deleted file mode 100644
index 713d45078d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java
+++ /dev/null
@@ -1,161 +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.jpa.core.internal.jpa2.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.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-
-/**
- * <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 JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
-
-
- public SourceCollectionTable2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.joinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.joinColumnsContainer.synchronize(this.getAstAnnotation(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 ListIterable<JoinColumnAnnotation> getJoinColumns() {
- return this.joinColumnsContainer.getNestedAnnotations();
- }
-
- public int getJoinColumnsSize() {
- return this.joinColumnsContainer.getNestedAnnotationsSize();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumnsContainer.nestedAnnotationAt(index);
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- return this.joinColumnsContainer.addNestedAnnotation(index);
- }
-
- private JoinColumnAnnotation buildJoinColumn(int index) {
- return SourceJoinColumnAnnotation.buildNestedSourceJoinColumnAnnotation(
- this, this.annotatedElement, buildJoinColumnIndexedDeclarationAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(
- this.daa, JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- this.joinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- }
-
- public void removeJoinColumn(int index) {
- this.joinColumnsContainer.removeNestedAnnotation(index);
- }
-
- /**
- * adapt the AnnotationContainer interface to the collection table's join columns
- */
- class JoinColumnsAnnotationContainer
- extends AnnotationContainer<JoinColumnAnnotation>
- {
- @Override
- protected String getAnnotationsPropertyName() {
- return JOIN_COLUMNS_LIST;
- }
- @Override
- protected String getElementName() {
- return JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS;
- }
- @Override
- protected String getNestedAnnotationName() {
- return JPA.JOIN_COLUMN;
- }
- @Override
- protected JoinColumnAnnotation buildNestedAnnotation(int index) {
- return SourceCollectionTable2_0Annotation.this.buildJoinColumn(index);
- }
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.joinColumnsContainer.isEmpty();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
deleted file mode 100644
index 4cd1d19e03..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java
+++ /dev/null
@@ -1,188 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.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.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-
-/**
- * org.eclipse.persistence.annotations.Transformation
- */
-public final class SourceElementCollection2_0Annotation
- extends SourceAnnotation
- implements ElementCollection2_0Annotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> TARGET_CLASS_ADAPTER = buildTargetClassAdapter();
- private final AnnotationElementAdapter<String> targetClassAdapter;
- private String targetClass;
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
- */
- private String fullyQualifiedTargetClassName;
- // we need a flag since the f-q name can be null
- private boolean fqTargetClassNameStale = true;
-
- private static final DeclarationAnnotationElementAdapter<String> FETCH_ADAPTER = buildFetchAdapter();
- private final AnnotationElementAdapter<String> fetchAdapter;
- private FetchType fetch;
-
-
- public SourceElementCollection2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.targetClassAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, TARGET_CLASS_ADAPTER);
- this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, FETCH_ADAPTER);
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.targetClass = this.buildTargetClass(astRoot);
- this.fetch = this.buildFetch(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncTargetClass(this.buildTargetClass(astRoot));
- this.syncFetch(this.buildFetch(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.targetClass == null) &&
- (this.fetch == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.targetClass);
- }
-
-
- // ********** ElementCollection2_0Annotation implementation **********
-
- // ***** target class
- public String getTargetClass() {
- return this.targetClass;
- }
-
- public void setTargetClass(String targetClass) {
- if (this.attributeValueHasChanged(this.targetClass, targetClass)) {
- this.targetClass = targetClass;
- this.fqTargetClassNameStale = true;
- this.targetClassAdapter.setValue(targetClass);
- }
- }
-
- private void syncTargetClass(String astTargetClass) {
- if (this.attributeValueHasChanged(this.targetClass, astTargetClass)) {
- this.syncTargetClass_(astTargetClass);
- }
- }
-
- private void syncTargetClass_(String astTargetClass) {
- String old = this.targetClass;
- this.targetClass = astTargetClass;
- this.fqTargetClassNameStale = true;
- this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, astTargetClass);
- }
-
- private String buildTargetClass(CompilationUnit astRoot) {
- return this.targetClassAdapter.getValue(astRoot);
- }
-
- public TextRange getTargetClassTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(TARGET_CLASS_ADAPTER, astRoot);
- }
-
- // ***** fully-qualified target entity class name
- public String getFullyQualifiedTargetClassName() {
- if (this.fqTargetClassNameStale) {
- this.fullyQualifiedTargetClassName = this.buildFullyQualifiedTargetClassName();
- this.fqTargetClassNameStale = false;
- }
- return this.fullyQualifiedTargetClassName;
- }
-
- private String buildFullyQualifiedTargetClassName() {
- return (this.targetClass == null) ? null : this.buildFullyQualifiedTargetClassName_();
- }
-
- private String buildFullyQualifiedTargetClassName_() {
- return ASTTools.resolveFullyQualifiedName(this.targetClassAdapter.getExpression(this.buildASTRoot()));
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- if (this.attributeValueHasChanged(this.fetch, fetch)) {
- this.fetch = fetch;
- this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
- }
- }
-
- private void syncFetch(FetchType astFetch) {
- FetchType old = this.fetch;
- this.fetch = astFetch;
- this.firePropertyChanged(FETCH_PROPERTY, old, astFetch);
- }
-
- private FetchType buildFetch(CompilationUnit astRoot) {
- return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(FETCH_ADAPTER, astRoot);
- }
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ELEMENT_COLLECTION__FETCH);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildTargetClassAdapter() {
- return buildTargetClassAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildTargetClassAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- // TODO what about QualifiedType?
- return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
deleted file mode 100644
index af81759ef7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java
+++ /dev/null
@@ -1,220 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import java.util.Arrays;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-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.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation;
-
-/**
- * javax.annotation.Generated
- */
-public final class SourceGeneratedAnnotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, 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 ListIterable<String> getValues() {
- return new LiveCloneListIterable<String>(this.values);
- }
-
- public int getValuesSize() {
- return this.values.size();
- }
-
- public String getValue(int index) {
- return this.values.get(index);
- }
-
- public void addValue(String value) {
- this.addValue(this.values.size(), value);
- }
-
- public void addValue(int index, String value) {
- this.values.add(index, value);
- this.writeValues();
- }
-
- public void moveValue(int targetIndex, int sourceIndex) {
- CollectionTools.move(this.values, targetIndex, sourceIndex);
- this.writeValues();
- }
-
- public void removeValue(String value) {
- this.values.remove(value);
- this.writeValues();
- }
-
- public void removeValue(int index) {
- this.values.remove(index);
- this.writeValues();
- }
-
- private void writeValues() {
- this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()]));
- }
-
- private void initializeValues(CompilationUnit astRoot) {
- String[] astValues = this.valueAdapter.getValue(astRoot);
- for (int i = 0; i < astValues.length; i++) {
- this.values.add(astValues[i]);
- }
- }
-
- private void syncValues(CompilationUnit astRoot) {
- String[] astValues = this.valueAdapter.getValue(astRoot);
- this.synchronizeList(Arrays.asList(astValues), this.values, VALUES_LIST);
- }
-
- // ***** date
- public String getDate() {
- return this.date;
- }
-
- public void setDate(String date) {
- if (this.attributeValueHasChanged(this.date, date)) {
- this.date = date;
- this.dateAdapter.setValue(date);
- }
- }
-
- protected void syncDate(String astDate) {
- String old = this.date;
- this.date = astDate;
- this.firePropertyChanged(DATE_PROPERTY, old, astDate);
- }
-
- private String buildDate(CompilationUnit astRoot) {
- return this.dateAdapter.getValue(astRoot);
- }
-
- // ***** comments
- public String getComments() {
- return this.comments;
- }
-
- public void setComments(String comments) {
- if (this.attributeValueHasChanged(this.comments, comments)) {
- this.comments = comments;
- this.commentsAdapter.setValue(comments);
- }
- }
-
- protected void syncComments(String astComments) {
- String old = this.comments;
- this.comments = astComments;
- this.firePropertyChanged(COMMENTS_PROPERTY, old, astComments);
- }
-
- private String buildComments(CompilationUnit astRoot) {
- return this.commentsAdapter.getValue(astRoot);
- }
-
-
- // ********** static methods **********
-
- protected static DeclarationAnnotationElementAdapter<String[]> buildValueAdapter() {
- return buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, VALUE_ELEMENT_NAME);
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings());
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String[]> converter) {
- return new ConversionDeclarationAnnotationElementAdapter<String[]>(annotationAdapter, elementName, converter);
- }
-
- protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
- return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
- static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
deleted file mode 100644
index 42f7ea3fae..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java
+++ /dev/null
@@ -1,138 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation;
-
-/**
- * javax.persistence.MapKeyClass
- */
-public final class SourceMapKeyClass2_0Annotation
- extends SourceAnnotation
- implements MapKeyClass2_0Annotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private String value;
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
- */
- private String fullyQualifiedClassName;
- // we need a flag since the f-q name can be null
- private boolean fqClassNameStale = true;
-
-
- public SourceMapKeyClass2_0Annotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** MapKeyClass2_0Annotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.fqClassNameStale = true;
- this.valueAdapter.setValue(value);
- }
- }
-
- private void syncValue(String astValue) {
- if (this.attributeValueHasChanged(this.value, astValue)) {
- this.syncValue_(astValue);
- }
- }
-
- private void syncValue_(String astValue) {
- String old = this.value;
- this.value = astValue;
- this.fqClassNameStale = true;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- // ***** fully-qualified class name
- public String getFullyQualifiedClassName() {
- if (this.fqClassNameStale) {
- this.fullyQualifiedClassName = this.buildFullyQualifiedClassName();
- this.fqClassNameStale = false;
- }
- return this.fullyQualifiedClassName;
- }
-
- private String buildFullyQualifiedClassName() {
- return (this.value == null) ? null : this.buildFullyQualifiedClassName_();
- }
-
- private String buildFullyQualifiedClassName_() {
- return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot()));
- }
-
-
- // ********** static methods **********
-
- protected static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.MAP_KEY_CLASS__VALUE, SimpleTypeStringExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
deleted file mode 100644
index be914944d3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java
+++ /dev/null
@@ -1,95 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompleteColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation;
-
-/**
- * <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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return MapKeyColumn2_0Annotation.ANNOTATION_NAME;
- }
-
-
- // ********** SourceNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA2_0.MAP_KEY_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA2_0.MAP_KEY_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** SourceBaseColumnAnnotation implementation **********
-
- @Override
- protected String getTableElementName() {
- return JPA2_0.MAP_KEY_COLUMN__TABLE;
- }
-
- @Override
- protected String getUniqueElementName() {
- return JPA2_0.MAP_KEY_COLUMN__UNIQUE;
- }
-
- @Override
- protected String getNullableElementName() {
- return JPA2_0.MAP_KEY_COLUMN__NULLABLE;
- }
-
- @Override
- protected String getInsertableElementName() {
- return JPA2_0.MAP_KEY_COLUMN__INSERTABLE;
- }
-
- @Override
- protected String getUpdatableElementName() {
- return JPA2_0.MAP_KEY_COLUMN__UPDATABLE;
- }
-
- // ********** SourceCompleteColumnAnnotation implementation **********
-
- @Override
- protected String getLengthElementName() {
- return JPA2_0.MAP_KEY_COLUMN__LENGTH;
- }
-
- @Override
- protected String getPrecisionElementName() {
- return JPA2_0.MAP_KEY_COLUMN__PRECISION;
- }
-
- @Override
- protected String getScaleElementName() {
- return JPA2_0.MAP_KEY_COLUMN__SCALE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
deleted file mode 100644
index 76b85cef77..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java
+++ /dev/null
@@ -1,41 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseEnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME;
- }
-
- @Override
- protected String getValueElementName() {
- return JPA2_0.MAP_KEY_ENUMERATED__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyJoinColumn2_0Annotation.java
deleted file mode 100644
index 576ad56f5f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyJoinColumn2_0Annotation.java
+++ /dev/null
@@ -1,145 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-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.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation;
-
-/**
- * <code>javax.persistence.MapKeyJoinColumn</code>
- */
-public final class SourceMapKeyJoinColumn2_0Annotation
- extends SourceBaseJoinColumnAnnotation
- implements MapKeyJoinColumn2_0Annotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA2_0.MAP_KEY_JOIN_COLUMNS);
-
-
- public static SourceMapKeyJoinColumn2_0Annotation buildSourceMapKeyJoinColumnAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element) {
-
- return new SourceMapKeyJoinColumn2_0Annotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public static SourceMapKeyJoinColumn2_0Annotation buildSourceMapKeyJoinColumnAnnotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement annotatedElement,
- int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildMapKeyJoinColumnDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildMapKeyJoinColumnAnnotationAdapter(annotatedElement, idaa);
- return new SourceMapKeyJoinColumn2_0Annotation(
- parent,
- annotatedElement,
- idaa,
- iaa);
- }
-
- public static SourceMapKeyJoinColumn2_0Annotation buildNestedSourceMapKeyJoinColumnAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- return new SourceMapKeyJoinColumn2_0Annotation(parent, element, idaa);
- }
-
- private SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- private SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
- }
-
- private SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, daa, annotationAdapter);
- }
-
- 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 **********
-
- private static IndexedAnnotationAdapter buildMapKeyJoinColumnAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
- return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildMapKeyJoinColumnDeclarationAnnotationAdapter(int index) {
- IndexedDeclarationAnnotationAdapter idaa =
- new CombinationIndexedDeclarationAnnotationAdapter(
- DECLARATION_ANNOTATION_ADAPTER,
- CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
- index,
- ANNOTATION_NAME);
- return idaa;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
deleted file mode 100644
index b41f402c7a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java
+++ /dev/null
@@ -1,42 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTemporalAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return MapKeyTemporal2_0Annotation.ANNOTATION_NAME;
- }
-
- @Override
- protected String getValueElementName() {
- return JPA2_0.MAP_KEY_TEMPORAL__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
deleted file mode 100644
index a586b20fc0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java
+++ /dev/null
@@ -1,108 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation;
-
-/**
- * javax.persistence.MapsId
- */
-public final class SourceMapsId2_0Annotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** MapsId2_0Annotation implementation **********
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.valueAdapter.setValue(value);
- }
- }
-
- private void syncValue(String astValue) {
- String old = this.value;
- this.value = astValue;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- public boolean valueTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(VALUE_ADAPTER, pos, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(
- DECLARATION_ANNOTATION_ADAPTER, JPA2_0.MAPS_ID__VALUE);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
deleted file mode 100644
index 07c7c1af35..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java
+++ /dev/null
@@ -1,123 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation;
-
-/**
- * <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 static SourceNamedQuery2_0Annotation buildSourceNamedQueryAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildNamedQueryDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildNamedQueryAnnotationAdapter(annotatedElement, idaa);
- return new SourceNamedQuery2_0Annotation(
- parent,
- annotatedElement,
- idaa,
- iaa);
- }
-
- private SourceNamedQuery2_0Annotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement annotatedElement,
- IndexedDeclarationAnnotationAdapter daa,
- IndexedAnnotationAdapter annotationAdapter) {
- super(parent, annotatedElement, daa, annotationAdapter);
- this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter();
- this.lockModeAdapter = this.buildLockModeAdapter();
- }
-
- 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);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
deleted file mode 100644
index 2138f1c39f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java
+++ /dev/null
@@ -1,213 +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.jpa.core.internal.jpa2.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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedColumnAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation;
-
-/**
- * <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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, 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);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
deleted file mode 100644
index 99322b3e8e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java
+++ /dev/null
@@ -1,127 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation;
-
-/**
- * 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, AnnotatedElement element) {
- super(parent, element);
- this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER);
- this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER);
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.catalog = this.buildCatalog(astRoot);
- this.schema = this.buildSchema(astRoot);
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.syncCatalog(this.buildCatalog(astRoot));
- this.syncSchema(this.buildSchema(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.catalog == null) &&
- (this.schema == null);
- }
-
-
- // ********** catalog **********
- public String getCatalog() {
- return this.catalog;
- }
-
- public void setCatalog(String catalog) {
- if (this.attributeValueHasChanged(this.catalog, catalog)) {
- this.catalog = catalog;
- this.catalogAdapter.setValue(catalog);
- }
- }
-
- private void syncCatalog(String astCatalog) {
- String old = this.catalog;
- this.catalog = astCatalog;
- this.firePropertyChanged(CATALOG_PROPERTY, old, astCatalog);
- }
-
- private String buildCatalog(CompilationUnit astRoot) {
- return this.catalogAdapter.getValue(astRoot);
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(CATALOG_ADAPTER, astRoot);
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(CATALOG_ADAPTER, pos, astRoot);
- }
-
- // ********** schema **********
- public String getSchema() {
- return this.schema;
- }
-
- public void setSchema(String schema) {
- if (this.attributeValueHasChanged(this.schema, schema)) {
- this.schema = schema;
- this.schemaAdapter.setValue(schema);
- }
- }
-
- private void syncSchema(String astSchema) {
- String old = this.schema;
- this.schema = astSchema;
- this.firePropertyChanged(SCHEMA_PROPERTY, old, astSchema);
- }
-
- private String buildSchema(CompilationUnit astRoot) {
- return this.schemaAdapter.getValue(astRoot);
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(SCHEMA_ADAPTER, astRoot);
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(SCHEMA_ADAPTER, pos, astRoot);
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
deleted file mode 100644
index a3a0190203..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java
+++ /dev/null
@@ -1,133 +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.jpa.core.internal.jpa2.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-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.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation;
-
-/**
- * javax.persistence.metamodel.StaticMetamodel
- */
-public final class SourceStaticMetamodelAnnotation
- extends SourceAnnotation
- implements StaticMetamodelAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter();
- private final AnnotationElementAdapter<String> valueAdapter;
- private String value;
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
- */
- private String fullyQualifiedClassName;
- // we need a flag since the f-q name can be null
- private boolean fqClassNameStale = true;
-
-
- public SourceStaticMetamodelAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** StaticMetamodelAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.fqClassNameStale = true;
- this.valueAdapter.setValue(value);
- }
- }
-
- private void syncValue(String astValue) {
- if (this.attributeValueHasChanged(this.value, astValue)) {
- this.syncValue_(astValue);
- }
- }
-
- private void syncValue_(String astValue) {
- String old = this.value;
- this.value = astValue;
- this.fqClassNameStale = true;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- // ***** fully-qualified class name
- public String getFullyQualifiedClassName() {
- if (this.fqClassNameStale) {
- this.fullyQualifiedClassName = this.buildFullyQualifiedClassName();
- this.fqClassNameStale = false;
- }
- return this.fullyQualifiedClassName;
- }
-
- private String buildFullyQualifiedClassName() {
- return (this.value == null) ? null : this.buildFullyQualifiedClassName_();
- }
-
- private String buildFullyQualifiedClassName_() {
- return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot()));
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.STATIC_METAMODEL__VALUE, SimpleTypeStringExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/ClassConstructor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/ClassConstructor.java
deleted file mode 100644
index ffff5e0fa5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/ClassConstructor.java
+++ /dev/null
@@ -1,143 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jdt.core.BindingKey;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link IConstructor} that is wrapping the {@link IMethod}
- * representation of a Java constructor (either coming from a Java compiled file or a Java source
- * file).
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class ClassConstructor implements IConstructor {
-
- /**
- * The information of the constructor.
- */
- private IMethod method;
-
- /**
- * The declaring type of this constructor.
- */
- private JpaType type;
-
- /**
- * The cached {@link ITypeDeclaration ITypeDeclarations} representing each of the constructor's
- * parameter types.
- */
- private ITypeDeclaration[] typeDeclarations;
-
- /**
- * Creates a new <code>ClassConstructor</code>.
- *
- * @param type The declaring type of this constructor
- * @param methodInfo The information of the constructor
- */
- ClassConstructor(JpaType type, IMethod method) {
- super();
- this.type = type;
- this.method = method;
- }
-
- private ITypeDeclaration[] buildParameterTypes() {
-
- BindingKey bindingKey = new BindingKey(method.getKey());
- String signature = bindingKey.toSignature();
-
- int count = Signature.getParameterCount(signature);
- ITypeDeclaration[] typeDeclarations = new ITypeDeclaration[count];
- int index = 0;
-
- for (String parameterType : Signature.getParameterTypes(signature)) {
-
- // 1. Retrieve the parameter type (without the type parameters)
- String parameterTypeName = Signature.getTypeErasure(parameterType);
-
- // 3. Convert the type signature to a dot-based name
- parameterTypeName = Signature.toString(parameterTypeName);
-
- // 4. Create the ITypeDeclaration
- typeDeclarations[index++] = new JpaTypeDeclaration(
- getTypeRepository().getType(parameterTypeName),
- buildTypeParameters(parameterType),
- Signature.getArrayCount(parameterType)
- );
- }
-
- return typeDeclarations;
- }
-
- private ITypeDeclaration[] buildTypeParameters(String signature) {
-
- String[] typeParameters = Signature.getTypeArguments(signature);
- ITypeDeclaration[] generics = new ITypeDeclaration[typeParameters.length];
-
- for (int index = 0; index < typeParameters.length; index++) {
- String typeParameter = typeParameters[index];
-
- // 1. Retrieve the parameter type (without the wild cards)
- switch (Signature.getTypeSignatureKind(typeParameter)) {
- case Signature.WILDCARD_TYPE_SIGNATURE: {
- typeParameter = typeParameter.substring(1);
- }
- }
-
- if (typeParameter.length() == 0) {
- generics[index] = getTypeRepository().getTypeHelper().objectTypeDeclaration();
- }
- else {
- String typeParameterName = Signature.getTypeErasure(typeParameter);
-
- // 3. Convert the type signature to a dot-based name
- typeParameterName = Signature.toString(typeParameterName);
-
- // 3. Retrieve the IType for the type parameter
- IType genericType = getTypeRepository().getType(typeParameterName);
-
- if (genericType.isResolvable()) {
- generics[index] = genericType.getTypeDeclaration();
- }
- else {
- generics[index] = getTypeRepository().getTypeHelper().objectTypeDeclaration();
- }
- }
- }
-
- return generics;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration[] getParameterTypes() {
- if (typeDeclarations == null) {
- typeDeclarations = buildParameterTypes();
- }
- return typeDeclarations;
- }
-
- private ITypeRepository getTypeRepository() {
- return type.getTypeRepository();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java
deleted file mode 100644
index 0d914a9e04..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/IJpaType.java
+++ /dev/null
@@ -1,38 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-
-/**
- * An internal interface used by all 3 implementations of {@link IType}.
- *
- * @see JavaType
- * @see JpaType
- * @see SimpleType
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-interface IJpaType extends IType {
-
- /**
- * Manually sets the declaration of this {@link IType}, which gives the information about type
- * parameters, dimensionality, etc.
- *
- * @param typeDeclaration The external form of the type declaration
- */
- void setTypeDeclaration(JpaTypeDeclaration typeDeclaration);
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java
deleted file mode 100644
index 63a63a8d82..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaConstructor.java
+++ /dev/null
@@ -1,99 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Type;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link IConstructor} that is wrapping a Java constructor.
- *
- * @version 2.3
- * @since 2.3
- * @author Pascal Filion
- */
-final class JavaConstructor implements IConstructor {
-
- /**
- * The actual Java constructor.
- */
- private Constructor<?> constructor;
-
- /**
- * The cached {@link ITypeDeclaration parameter types}.
- */
- private ITypeDeclaration[] parameterTypes;
-
- /**
- * The declaring type of this constructor.
- */
- private JavaType type;
-
- /**
- * Creates a new <code>JavaConstructor</code>.
- *
- * @param type The declaring type of this constructor
- * @param constructor The actual Java constructor
- */
- JavaConstructor(JavaType type, Constructor<?> constructor) {
- super();
- this.type = type;
- this.constructor = constructor;
- }
-
- private ITypeDeclaration[] buildParameterTypes() {
-
- Class<?>[] types = constructor.getParameterTypes();
- Type[] genericTypes = constructor.getGenericParameterTypes();
- ITypeDeclaration[] typeDeclarations = new ITypeDeclaration[types.length];
-
- for (int index = 0, count = types.length; index < count; index++) {
- typeDeclarations[index] = buildTypeDeclaration(types[index], genericTypes[index]);
- }
-
- return typeDeclarations;
- }
-
- private ITypeDeclaration buildTypeDeclaration(Class<?> javaType, Type genericType) {
- ITypeRepository typeRepository = getTypeRepository();
- IType type = typeRepository.getType(javaType);
- return new JavaTypeDeclaration(typeRepository, type, genericType, javaType.isArray());
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration[] getParameterTypes() {
- if (parameterTypes == null) {
- parameterTypes = buildParameterTypes();
- }
- return parameterTypes;
- }
-
- private ITypeRepository getTypeRepository() {
- return type.getTypeRepository();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return constructor.toGenericString();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java
deleted file mode 100644
index 517e08caf1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaType.java
+++ /dev/null
@@ -1,246 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link IType} that is wrapping a Java type.
- *
- * @version 2.3
- * @since 2.3
- * @author Pascal Filion
- */
-final class JavaType implements IJpaType {
-
- /**
- * The cached {@link IConstructor IConstructors}.
- */
- private Collection<IConstructor> constructors;
-
- /**
- * The list of names for the {@link Enum}'s constants otherwise an empty array.
- */
- private String[] enumConstants;
-
- /**
- * The actual Java type.
- */
- private Class<?> type;
-
- /**
- * The cached {@link ITypeDeclaration} for this {@link IType}.
- */
- private ITypeDeclaration typeDeclaration;
-
- /**
- * The fully qualified name of the Java type.
- */
- private String typeName;
-
- /**
- * The external form of a type repository.
- */
- private ITypeRepository typeRepository;
-
- /**
- * Creates a new <code>JavaType</code>.
- *
- * @param typeRepository The external form of a type repository
- * @param type The actual Java type wrapped by this class
- */
- JavaType(ITypeRepository typeRepository, Class<?> type) {
- super();
- this.type = type;
- this.typeName = type.getName();
- this.typeRepository = typeRepository;
- }
-
- private IConstructor buildConstructor(Constructor<?> constructor) {
- return new JavaConstructor(this, constructor);
- }
-
- private Collection<IConstructor> buildConstructors() {
-
- Constructor<?>[] javaConstructors = type.getDeclaredConstructors();
- Collection<IConstructor> constructors = new ArrayList<IConstructor>(javaConstructors.length);
-
- for (Constructor<?> javaConstructor : javaConstructors) {
- constructors.add(buildConstructor(javaConstructor));
- }
-
- return constructors;
- }
-
- private String[] buildEnumConstants() {
-
- if (!type.isEnum()) {
- return ExpressionTools.EMPTY_STRING_ARRAY;
- }
-
- Object[] enumConstants = type.getEnumConstants();
- String[] names = new String[enumConstants.length];
-
- for (int index = enumConstants.length; --index >= 0; ) {
- names[index] = ((Enum<?>) enumConstants[index]).name();
- }
-
- return names;
- }
-
- /**
- * {@inheritDoc}
- */
- public Iterable<IConstructor> constructors() {
- if (constructors == null) {
- constructors = buildConstructors();
- }
- return Collections.unmodifiableCollection(constructors);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(IType type) {
- return (this == type) ? true : typeName.equals(type.getName());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object object) {
- return (this == object) || equals((IType) object);
- }
-
- /**
- * {@inheritDoc}
- */
- public String[] getEnumConstants() {
- if (enumConstants == null) {
- enumConstants = buildEnumConstants();
- }
- return enumConstants;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return typeName;
- }
-
- /**
- * Returns the encapsulated {@link Class}, which is the actual type.
- *
- * @return The actual Java type, if <code>null</code> is returned; then the class could not be resolved
- */
- Class<?> getType() {
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration getTypeDeclaration() {
- if (typeDeclaration == null) {
- typeDeclaration = new JavaTypeDeclaration(typeRepository, this, null, (type != null) ? type.isArray() : false);
- }
- return typeDeclaration;
- }
-
- /**
- * Returns the type repository for the application.
- *
- * @return The repository of {@link IType ITypes}
- */
- ITypeRepository getTypeRepository() {
- return typeRepository;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasAnnotation(Class<? extends Annotation> annotationType) {
- return type.isAnnotationPresent(annotationType);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return typeName.hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAssignableTo(IType type) {
-
- if (this == type) {
- return true;
- }
-
- // TODO
- if (type instanceof JavaType) {
- Class<?> otherType = ((JavaType) type).type;
- return otherType.isAssignableFrom(this.type);
- }
- else if (type instanceof JpaType) {
- // TODO
- return false;
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isEnum() {
- return (type != null) && type.isEnum();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isResolvable() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setTypeDeclaration(JpaTypeDeclaration typeDeclaration) {
- this.typeDeclaration = typeDeclaration;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return typeName;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java
deleted file mode 100644
index d33231a442..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JavaTypeDeclaration.java
+++ /dev/null
@@ -1,271 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link ITypeDeclaration} that is wrapping the representation
- * of the declaration description of a type.
- *
- * @see IMapping
- * @see IType
- *
- * @version 2.3
- * @since 2.3
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-final class JavaTypeDeclaration implements ITypeDeclaration {
-
- /**
- * Determines whether the type declaration represents an array.
- */
- private boolean array;
-
- /**
- * The actual type that contains the generics, if any is present.
- */
- private Object genericType;
-
- /**
- * The cached {@link ITypeDeclaration ITypeDeclarations} representing the generics of the {@link
- * Type}.
- */
- private ITypeDeclaration[] genericTypes;
-
- /**
- * The external form of the Java type.
- */
- private final IType type;
-
- /**
- * The repository of {@link IType ITypes}.
- */
- private ITypeRepository typeRepository;
-
- /**
- * Creates a new <code>JavaTypeDeclaration</code>.
- *
- * @param typeRepository The repository of {@link IType ITypes}
- * @param type The external form of the Java type
- * @param genericType The actual type that contains the generics, if any is present
- * @param array Determines whether the type declaration represents an array
- */
- JavaTypeDeclaration(ITypeRepository typeRepository,
- IType type,
- Object genericType,
- boolean array) {
-
- super();
- this.type = type;
- this.array = array;
- this.genericType = genericType;
- this.typeRepository = typeRepository;
- }
-
- private String buildArrayTypeName(String arrayTypeName) {
-
- StringBuilder sb = new StringBuilder();
- int index = arrayTypeName.indexOf('[');
- int dimensionality = (arrayTypeName.length() - index) / 2;
- String typeName = arrayTypeName.substring(0, index);
-
- while (--dimensionality >= 0) {
- sb.append("[");
- }
-
- String elementType = elementType(typeName);
-
- sb.append(elementType);
- sb.append(typeName);
-
- if (elementType.equals("L")) {
- sb.append(";");
- }
-
- return sb.toString();
- }
-
- private ITypeDeclaration[] buildParameterTypes() {
-
- List<ITypeDeclaration> parameterTypes = new ArrayList<ITypeDeclaration>();
-
- // Example: Class<T>
- if (genericType instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) genericType;
- for (Type type : parameterizedType.getActualTypeArguments()) {
- ITypeDeclaration typeParameter = buildTypeDeclaration(type);
- parameterTypes.add(typeParameter);
- }
- }
- // T[]
- else if (genericType instanceof GenericArrayType) {
- GenericArrayType genericArrayType = (GenericArrayType) genericType;
- parameterTypes.add(buildTypeDeclaration(genericArrayType.getGenericComponentType()));
- }
- // Example: Class
- else if (genericType.getClass() == Class.class) {
- ITypeDeclaration typeParameter = buildTypeDeclaration((Class<?>) genericType);
- parameterTypes.add(typeParameter);
- }
- // Example: <K, V>
- else if (genericType.getClass() == Class[].class) {
- for (Class<?> javaType : ((Class<?>[]) genericType)) {
- ITypeDeclaration typeParameter = buildTypeDeclaration(javaType);
- parameterTypes.add(typeParameter);
- }
- }
- // Example: <K, V>
- else if (genericType.getClass() == IType[].class) {
- for (IType type : ((IType[]) genericType)) {
- ITypeDeclaration typeParameter = new JavaTypeDeclaration(typeRepository, type, null, false);
- parameterTypes.add(typeParameter);
- }
- }
-
- return parameterTypes.toArray(new ITypeDeclaration[parameterTypes.size()]);
- }
-
- private JavaTypeDeclaration buildTypeDeclaration(Class<?> javaType) {
- return new JavaTypeDeclaration(
- typeRepository,
- getType(javaType),
- null,
- javaType.isArray()
- );
- }
-
- private JavaTypeDeclaration buildTypeDeclaration(Object genericType) {
-
- // <T1, ..., Tn>
- if (genericType instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType) genericType;
- return buildTypeDeclaration(parameterizedType.getRawType());
- }
-
- // <T>
- if (genericType instanceof TypeVariable) {
- TypeVariable<?> typeVariable = (TypeVariable<?>) genericType;
- for (Type type : typeVariable.getBounds()) {
- return buildTypeDeclaration(type);
- }
- return buildTypeDeclaration(Object.class);
- }
-
- // ?
- if (genericType instanceof WildcardType) {
- WildcardType wildcardType = (WildcardType) genericType;
- for (Type type : wildcardType.getUpperBounds()) {
- return buildTypeDeclaration(type);
- }
- return buildTypeDeclaration(Object.class);
- }
-
- // T[]
- if (genericType instanceof GenericArrayType) {
- GenericArrayType genericArrayType = (GenericArrayType) genericType;
- String arrayTypeName = buildArrayTypeName(genericArrayType.toString());
- IType arrayType = typeRepository.getType(arrayTypeName);
-
- return new JavaTypeDeclaration(
- typeRepository,
- arrayType,
- genericArrayType.getGenericComponentType(),
- true
- );
- }
-
- return buildTypeDeclaration((Class<?>) genericType);
- }
-
- private String elementType(String typeName) {
-
- if (typeName.equals("boolean")) return "Z";
- if (typeName.equals("byte")) return "B";
- if (typeName.equals("char")) return "C";
- if (typeName.equals("double")) return "D";
- if (typeName.equals("float")) return "F";
- if (typeName.equals("int")) return "I";
- if (typeName.equals("long")) return "J";
- if (typeName.equals("short")) return "S";
-
- return "L";
- }
-
- /**
- * {@inheritDoc}
- */
- public int getDimensionality() {
- if (array) {
- String name = type.getName();
- int index = 0;
- while (name.charAt(index) == '[') {
- index++;
- }
- return index;
- }
- return 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public IType getType() {
- return type;
- }
-
- private IType getType(Class<?> type) {
- return typeRepository.getType(type);
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration[] getTypeParameters() {
- if (genericTypes == null) {
- if (genericType == null) {
- genericTypes = new ITypeDeclaration[0];
- }
- else {
- genericTypes = buildParameterTypes();
- }
- }
- return genericTypes;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isArray() {
- return array;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return (genericType != null) ? genericType.toString() : type.toString();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java
deleted file mode 100644
index 001937bdcc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaConstructor.java
+++ /dev/null
@@ -1,140 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link IConstructor} that is wrapping the design-time
- * representation of a Java constructor.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaConstructor implements IConstructor {
-
- /**
- * The design-time representation of a Java constructor.
- */
- private IMethodBinding constructor;
-
- /**
- * The cached {@link ITypeDeclaration ITypeDeclarations} representing each of the constructor's
- * parameter types.
- */
- private ITypeDeclaration[] typeDeclarations;
-
- /**
- * The type owning this constructor.
- */
- private JpaType type;
-
- /**
- * Creates a new <code>JpaConstructor</code>.
- *
- * @param type The type owning the constructor
- * @param constructor The design-time representation of a Java constructor
- */
- JpaConstructor(JpaType type, IMethodBinding constructor) {
- super();
- this.type = type;
- this.constructor = constructor;
- }
-
- private ITypeDeclaration buildTypeDeclaration(ITypeBinding parameterType) {
-
- boolean array = parameterType.isArray();
- String typeParameterName;
-
- if (array) {
- ITypeBinding componentType = parameterType.getComponentType();
-
- // <T>[] or <? extends <class_name>>[]
- if (componentType.isTypeVariable() ||
- componentType.isParameterizedType()) {
-
- typeParameterName = componentType.getErasure().getQualifiedName();
- }
- else {
- typeParameterName = componentType.getQualifiedName();
- }
-
- // Now for the type arguments, we have to use the component type
- parameterType = componentType;
- }
- // <T> or <? extends <class_name>>
- else if (parameterType.isTypeVariable() ||
- parameterType.isParameterizedType()) {
-
- typeParameterName = parameterType.getErasure().getQualifiedName();
- }
- else {
- typeParameterName = parameterType.getQualifiedName();
- }
-
- // Retrieve the fully qualified name of the type
- ITypeRepository typeRepository = type.getTypeRepository();
- ITypeBinding[] typeArguments = parameterType.getTypeArguments();
- ITypeDeclaration[] genericTypes = new ITypeDeclaration[typeArguments.length];
- int index = 0;
-
- for (ITypeBinding typeArgument : typeArguments) {
- String genericTypeName = typeArgument.getErasure().getQualifiedName();
- IType genericType = typeRepository.getType(genericTypeName);
- genericTypes[index++] = genericType.getTypeDeclaration();
- }
-
- return new JpaTypeDeclaration(
- typeRepository.getType(typeParameterName),
- genericTypes,
- parameterType.getDimensions()
- );
- }
-
- private ITypeDeclaration[] buildTypeDeclarations() {
-
- ITypeBinding[] parameterTypes = constructor.getParameterTypes();
- ITypeDeclaration[] declarations = new ITypeDeclaration[parameterTypes.length];
-
- for (int index = declarations.length; --index >= 0; ) {
- declarations[index] = buildTypeDeclaration(parameterTypes[index]);
- }
-
- return declarations;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration[] getParameterTypes() {
- if (typeDeclarations == null) {
- typeDeclarations = buildTypeDeclarations();
- }
- return typeDeclarations;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return constructor.toString();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java
deleted file mode 100644
index 2bbf9b4639..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEmbeddable.java
+++ /dev/null
@@ -1,63 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.persistence.jpa.jpql.spi.IEmbeddable;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
-
-/**
- * The concrete implementation of {@link IEmbeddable} that is wrapping the design-time
- * representation of a JPA embeddable.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaEmbeddable extends JpaManagedType
- implements IEmbeddable {
-
- /**
- * Creates a new <code>JpaEmbeddable</code>.
- *
- * @param provider The provider of JPA managed types
- * @param embeddable The design-time model object wrapped by this class
- */
- JpaEmbeddable(JpaManagedTypeProvider provider, Embeddable embeddable) {
- super(provider, embeddable);
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(IManagedTypeVisitor visitor) {
- visitor.visit(this);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- Embeddable getManagedType() {
- return (Embeddable) super.getManagedType();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return getType().getName();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
deleted file mode 100644
index 952d00ba1f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaEntity.java
+++ /dev/null
@@ -1,110 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.persistence.jpa.jpql.spi.IEntity;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
-import org.eclipse.persistence.jpa.jpql.spi.IQuery;
-
-/**
- * The concrete implementation of {@link IEntity} that is wrapping the design-time representation
- * of a JPA entity.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-abstract class JpaEntity extends JpaManagedType
- implements IEntity {
-
- /**
- * The cached used to quickly retrieve any queries that have been cached.
- */
- private Map<String, IQuery> queries;
-
- /**
- * Creates a new <code>JpaEntity</code>.
- *
- * @param provider The provider of JPA managed types
- * @param entity The design-time model object wrapped by this class
- */
- JpaEntity(JpaManagedTypeProvider provider, Entity entity) {
- super(provider, entity);
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(IManagedTypeVisitor visitor) {
- visitor.visit(this);
- }
-
- final IQuery buildQuery(JpaManagedTypeProvider provider, NamedQuery namedQuery) {
- return new JpaQuery(provider, namedQuery);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- Entity getManagedType() {
- return (Entity) super.getManagedType();
- }
-
- /**
- * {@inheritDoc}
- */
- public final String getName() {
- return getManagedType().getName();
- }
-
- /**
- * {@inheritDoc}
- */
- public IQuery getNamedQuery(String queryName) {
- initializeQueries();
- return queries.get(queryName);
- }
-
- private void initializeQueries() {
- if (queries == null) {
- queries = new HashMap<String, IQuery>();
- initializeQueries(queries);
- }
- }
-
- void initializeQueries(Map<String, IQuery> queries) {
- JpaManagedTypeProvider provider = getProvider();
- for (NamedQuery namedQuery : getNamedQueries()) {
- queries.put(namedQuery.getName(), buildQuery(provider, namedQuery));
- }
- }
-
- private ListIterable<? extends NamedQuery> getNamedQueries() {
- return getManagedType().getQueryContainer().getNamedQueries();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return getName();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java
deleted file mode 100644
index 93ad568d77..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaJpqlQueryHelper.java
+++ /dev/null
@@ -1,245 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.util.List;
-import org.eclipse.jpt.common.core.internal.utility.SimpleTextRange;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationPreferences;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.persistence.jpa.jpql.JPQLQueryHelper;
-import org.eclipse.persistence.jpa.jpql.JPQLQueryProblem;
-import org.eclipse.persistence.jpa.jpql.spi.IQuery;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-/**
- * This helper can perform the following operations over a JPQL query:
- * <ul>
- * <li>Calculates the result type of a query: {@link #getResultType()};</li>
- * <li>Calculates the type of an input parameter: {@link #getParameterType(String)}.</li>
- * <li>Calculates the possible choices to complete the query from a given
- * position (used for content assist): {@link #buildContentAssistItems(int)}.</li>
- * <li>Validates the query by introspecting its grammar and semantic:
- * <ul>
- * <li>{@link #validate()},</li>
- * <li>{@link #validateGrammar()},</li>
- * <li>{@link #validateSemantic()}.</li>
- * </ul></li>
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-public final class JpaJpqlQueryHelper extends JPQLQueryHelper {
-
- /**
- * Caches the provider in order to prevent recreating the SPI representation of the JPA artifacts
- * more than once.
- */
- private JpaManagedTypeProvider managedTypeProvider;
-
- /**
- * Creates a new <code>JpaQueryHelper</code>.
- */
- public JpaJpqlQueryHelper() {
- super();
- }
-
- /**
- * Calculates the start and end positions by adjusting them to be at the same position within
- * <em>jpqlQuery</em>, which may differ from <em>parsedJpqlQuery</em> since the parsed tree does
- * not keep track of multiple whitespace. The range is also increased if the start and end
- * positions are the same.
- *
- * @param problem The {@link JPQLQueryProblem problem} that was found in the JPQL query, which is
- * either a grammatical or semantic problem
- * @param parsedJpqlQuery The string representation of the parsed tree representation of the JPQL
- * query
- * @param actualQuery The actual JPQL query that was parsed and validated
- * @return The start and end positions, which may have been adjusted
- */
- public int[] buildPositions(JPQLQueryProblem problem, String parsedJpqlQuery, String actualQuery) {
-
- int startPosition = problem.getStartPosition();
- int endPosition = problem.getEndPosition();
-
- // If the start and end positions are the same, then expand the text range
- if (startPosition == endPosition) {
- startPosition = Math.max(startPosition - 1, 0);
- }
-
- // Reposition the cursor so it's correctly positioned in the actual query, which is the
- // since it may contains more than one whitespace for a single whitespace
- int newStartPosition = ExpressionTools.repositionCursor(parsedJpqlQuery, startPosition, actualQuery);
-
- if (newStartPosition != startPosition) {
- endPosition += (newStartPosition - startPosition);
- startPosition = newStartPosition;
- }
-
- return new int[] { startPosition, endPosition };
- }
-
- /**
- * Creates a new {@link IMessage} for the given {@link JPQLQueryProblem}.
- *
- * @param namedQuery The model object for which a new {@link IMessage} is creating describing the
- * problem
- * @param problem The {@link JPQLQueryProblem problem} that was found in the JPQL query, which is
- * either a grammatical or semantic problem
- * @param textRange The range of the JPQL query in the Java source file
- * @param parsedJpqlQuery The string representation of the parsed tree representation of the JPQL
- * query, which may differ from the actual JPQL query since it does not keep more than one
- * whitespace
- * @param actualQuery The actual JPQL query that was parsed and validated
- * @param offset This offset is used to move the start position
- * @return A new {@link IMessage} that has the required information to display the problem
- * underline and the error message in the Problems view
- */
- private IMessage buildProblem(NamedQuery namedQuery,
- TextRange textRange,
- JPQLQueryProblem problem,
- String parsedJpqlQuery,
- String actualQuery,
- int offset) {
-
- // Convert the positions from the parsed JPQL query to the actual JPQL query
- int[] positions = buildPositions(problem, parsedJpqlQuery, actualQuery);
-
- // Now convert the adjusted positions once again to be in the query where the escape
- // characters are in their literal forms
- int[] newStartPosition = { positions[0] };
- ExpressionTools.escape(actualQuery, newStartPosition);
- int escapeOffset = positions[0] - newStartPosition[0];
-
- positions[0] -= escapeOffset;
- positions[1] -= escapeOffset;
-
- // Create the text range of the problem
- textRange = new SimpleTextRange(
- textRange.getOffset() + positions[0] + offset,
- positions[1] - positions[0],
- textRange.getLineNumber()
- );
-
- // Now create the message
- IMessage message = DefaultJpaValidationMessages.buildMessage(
- severity(namedQuery),
- problem.getMessageKey(),
- problem.getMessageArguments(),
- namedQuery,
- textRange
- );
- message.setBundleName("jpa_jpql_validation");
- return message;
- }
-
- private JpaManagedTypeProvider buildProvider(NamedQuery query) {
- try {
- return new JpaPersistenceUnit(query.getJpaProject(), query.getPersistenceUnit());
- }
- catch (Exception e) {
- return new JpaMappingFile(query.getJpaProject(), query.getMappingFileRoot().getParent());
- }
- }
-
- /**
- * Disposes the provider so the application metadata is not kept in memory.
- */
- public void disposeProvider() {
- managedTypeProvider = null;
- }
-
- /**
- * Sets the given named query and string representation of the JPQL query.
- *
- * @param namedQuery The model object where the JPQL query is stored
- * @param actualQuery The actual JPQL query, which can differ from the one owned by the model
- * object, which happens when the model is out of sync because it has not been updated yet
- */
- public void setQuery(NamedQuery namedQuery, String actualQuery) {
-
- if (managedTypeProvider == null) {
- managedTypeProvider = buildProvider(namedQuery);
- }
-
- IQuery query = new JpaQuery(managedTypeProvider, namedQuery, actualQuery);
- super.setQuery(query);
- }
-
- /**
- * Retrieve the severity that is associated to JPQL query validation, which cannot be retrieved
- * using the JPQL problem message key.
-
- * @param targetObject The object for which a new {@link IMessage} is creating describing the
- * problem
- * @return The global severity for validating JPQL queries
- */
- private int severity(Object targetObject) {
- return JpaValidationPreferences.getProblemSeverityPreference(
- targetObject,
- JpaValidationMessages.JPQL_QUERY_VALIDATION
- );
- }
-
- private boolean shouldValidate(NamedQuery namedQuery) {
- return JpaValidationPreferences.getProblemSeverityPreference(
- namedQuery,
- JpaValidationMessages.JPQL_QUERY_VALIDATION
- ) == -1;
- }
-
- /**
- * Validates the given {@link NamedQuery} by validating the JPQL query.
- *
- * @param namedQuery The JPQL query to validate
- * @param jpqlQuery The JPQL query, which might be different from what the model object since
- * the escape characters should not be in their literal forms (should have '\r' and not '\\r')
- * @param textRange The range of the JPQL query string within the document
- * @param offset This offset is used to move the start position
- * @param messages The list of {@link IMessage IMessages} that will be used to add validation
- * problems
- */
- public void validate(NamedQuery namedQuery,
- String jpqlQuery,
- TextRange textRange,
- int offset,
- List<IMessage> messages) {
-
- // Make this quick check so we don't validate the query, which is time consuming
- if (shouldValidate(namedQuery)) {
-
- setQuery(namedQuery, jpqlQuery);
- String parsedJpqlQuery = getParsedJPQLQuery();
-
- for (JPQLQueryProblem problem : validate()) {
-
- IMessage message = buildProblem(
- namedQuery,
- textRange,
- problem,
- parsedJpqlQuery,
- jpqlQuery,
- offset
- );
-
- messages.add(message);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java
deleted file mode 100644
index 57d78884bc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedType.java
+++ /dev/null
@@ -1,134 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
-import org.eclipse.persistence.jpa.jpql.spi.IMapping;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-
-/**
- * The abstract definition of {@link IManagedType} defined for wrapping the design-time mapped class
- * object.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-abstract class JpaManagedType implements IManagedType {
-
- /**
- * The design-time model object wrapped by this class.
- */
- private final TypeMapping managedType;
-
- /**
- * The cached collection of {@link IMapping mappings} that prevent rebuilding them every time one
- * is requested.
- */
- private Map<String, IMapping> mappings;
-
- /**
- * The provider of JPA managed types.
- */
- private final JpaManagedTypeProvider provider;
-
- /**
- * The cached type of this managed type.
- */
- private IType type;
-
- /**
- * Creates a new <code>JDeveloperManagedType</code>.
- *
- * @param managedType The provider of JPA managed types
- * @param mappedClass The design-time model object wrapped by this class
- */
- JpaManagedType(JpaManagedTypeProvider provider, TypeMapping managedType) {
- super();
- this.provider = provider;
- this.managedType = managedType;
- }
-
- private IMapping buildMapping(AttributeMapping mapping) {
- return new JpaMapping(this, mapping);
- }
-
- private Map<String, IMapping> buildMappings() {
- Map<String, IMapping> mappings = new HashMap<String, IMapping>();
- for (AttributeMapping mapping : managedType.getAllAttributeMappings()) {
- mappings.put(mapping.getName(), buildMapping(mapping));
- }
- return mappings;
- }
-
- /**
- * {@inheritDoc}
- */
- public int compareTo(IManagedType managedType) {
- return getType().getName().compareTo(managedType.getType().getName());
- }
-
- /**
- * Returns the encapsulated model object.
- *
- * @return The managed type wrapped by this external form
- */
- TypeMapping getManagedType() {
- return managedType;
- }
-
- /**
- * {@inheritDoc}
- */
- public final IMapping getMappingNamed(String name) {
- initializeMappings();
- return mappings.get(name);
- }
-
- /**
- * {@inheritDoc}
- */
- public final JpaManagedTypeProvider getProvider() {
- return provider;
- }
-
- /**
- * {@inheritDoc}
- */
- public final IType getType() {
- if (type == null) {
- type = provider.getTypeRepository().getType(managedType.getPersistentType().getName());
- }
- return type;
- }
-
- private void initializeMappings() {
- if (mappings == null) {
- mappings = buildMappings();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public final Iterable<IMapping> mappings() {
- initializeMappings();
- return Collections.unmodifiableCollection(mappings.values());
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java
deleted file mode 100644
index dc614dd395..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaManagedTypeProvider.java
+++ /dev/null
@@ -1,275 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.context.Embeddable;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer;
-import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaProject;
-import org.eclipse.persistence.jpa.jpql.spi.IEmbeddable;
-import org.eclipse.persistence.jpa.jpql.spi.IEntity;
-import org.eclipse.persistence.jpa.jpql.spi.IJPAVersion;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
-import org.eclipse.persistence.jpa.jpql.spi.IMappedSuperclass;
-import org.eclipse.persistence.jpa.jpql.spi.IPlatform;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-
-/**
- * The abstract implementation of {@link IManagedTypeProvider} that is wrapping the design-time
- * representation of a provider of managed types.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-abstract class JpaManagedTypeProvider implements IManagedTypeProvider {
-
- /**
- * The filtered collection of managed types that are the abstract schema types.
- */
- private Collection<IEntity> abstractSchemaTypes;
-
- /**
- * The project that gives access to the application's metadata.
- */
- private final JpaProject jpaProject;
-
- /**
- * The cached {@link IManagedType managed types}.
- */
- private Map<String, IManagedType> managedTypes;
-
- /**
- * The design-time provider of managed types.
- */
- private final PersistentTypeContainer persistentTypeContainer;
-
- /**
- * The external form of a type repository.
- */
- private JpaTypeRepository typeRepository;
-
- /**
- * The version of the Java Persistence this entity for which it was defined.
- */
- private IJPAVersion version;
-
- /**
- * Creates a new <code>JpaManagedTypeProvider</code>.
- *
- * @param jpaProject The project that gives access to the application's metadata
- * @param persistentTypeContainer The design-time provider of managed types
- */
- JpaManagedTypeProvider(JpaProject jpaProject, PersistentTypeContainer persistentTypeContainer) {
-
- super();
- this.jpaProject = jpaProject;
- this.persistentTypeContainer = persistentTypeContainer;
- }
-
- /**
- * {@inheritDoc}
- */
- public Iterable<IEntity> abstractSchemaTypes() {
- if (abstractSchemaTypes == null) {
- initializeManagedTypes();
- EntityCollector visitor = new EntityCollector();
- for (IManagedType managedType : managedTypes.values()) {
- managedType.accept(visitor);
- }
- abstractSchemaTypes = visitor.entities;
- }
- return Collections.unmodifiableCollection(abstractSchemaTypes);
- }
-
- abstract JpaEntity buildEntity(TypeMapping mappedClass);
-
- private IManagedType buildManagedType(PersistentType persistentType) {
-
- TypeMapping mappedClass = persistentType.getMapping();
-
- if (mappedClass instanceof Entity) {
- return buildEntity(mappedClass);
- }
-
- if (mappedClass instanceof MappedSuperclass) {
- return new JpaMappedSuperclass(this, (MappedSuperclass) mappedClass);
- }
-
- if (mappedClass instanceof Embeddable) {
- return new JpaEmbeddable(this, (Embeddable) mappedClass);
- }
-
- return new JpaNullManagedType(this, mappedClass);
- }
-
- private Map<String, IManagedType> buildManagedTypes() {
- Map<String, IManagedType> managedTypes = new HashMap<String, IManagedType>();
- for (PersistentType persistentType : persistenceTypes()) {
- if (persistentType != null) {
- managedTypes.put(persistentType.getMapping().getName(), buildManagedType(persistentType));
- }
- }
- return managedTypes;
- }
-
- private IJPAVersion convert(JpaPlatform.Version version) {
-
- String jpaVersion = version.getJpaVersion();
-
- if (JpaFacet.VERSION_1_0.getVersionString().equals(jpaVersion)) {
- return IJPAVersion.VERSION_1_0;
- }
-
- return IJPAVersion.VERSION_2_0;
- }
-
- /**
- * {@inheritDoc}
- */
- public IManagedType getManagedType(IType type) {
-
- initializeManagedTypes();
-
- for (IManagedType managedType : managedTypes.values()) {
- if (managedType.getType() == type) {
- return managedType;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public IManagedType getManagedType(String abstractSchemaName) {
- initializeManagedTypes();
- return managedTypes.get(abstractSchemaName);
- }
-
- /**
- * Returns the container of managed types.
- *
- * @return The container of managed types
- */
- PersistentTypeContainer getPersistentTypeContainer() {
- return persistentTypeContainer;
- }
-
- /**
- * {@inheritDoc}
- */
- public IPlatform getPlatform() {
- return (jpaProject instanceof GenericJpaProject) ? IPlatform.JAVA : IPlatform.ECLIPSE_LINK;
- }
-
- /**
- * Returns the encapsulated {@link PersistentType}, which is the actual object.
- *
- * @return The design-time representation of a managed type provider
- */
- PersistentTypeContainer getProvider() {
- return persistentTypeContainer;
- }
-
- /**
- * {@inheritDoc}
- */
- public JpaTypeRepository getTypeRepository() {
- if (typeRepository == null) {
- typeRepository = new JpaTypeRepository(jpaProject.getJavaProject());
- }
- return typeRepository;
- }
-
- /**
- * {@inheritDoc}
- */
- public IJPAVersion getVersion() {
- if (version == null) {
- version = convert(jpaProject.getJpaPlatform().getJpaVersion());
- }
- return version;
- }
-
- private void initializeManagedTypes() {
- if (managedTypes == null) {
- managedTypes = buildManagedTypes();
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public Iterable<IManagedType> managedTypes() {
- initializeManagedTypes();
- return Collections.unmodifiableCollection(managedTypes.values());
- }
-
- /**
- * Retrieves the managed types from the design-time provider.
- *
- * @return The managed types that are defined only in the provider
- */
- abstract Iterable<? extends PersistentType> persistenceTypes();
-
- private static class EntityCollector implements IManagedTypeVisitor {
-
- /**
- * The collection of {@link IEntity entities} that got visited.
- */
- private final Collection<IEntity> entities;
-
- /**
- * Creates a new <code>EntityCollector</code>.
- */
- EntityCollector() {
- super();
- entities = new ArrayList<IEntity>();
- }
-
- /**
- * {@inheritDoc}
- */
- public void visit(IEmbeddable embeddable) {
- }
-
- /**
- * {@inheritDoc}
- */
- public void visit(IEntity entity) {
- entities.add(entity);
- }
-
- /**
- * {@inheritDoc}
- */
- public void visit(IMappedSuperclass mappedSuperclass) {
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java
deleted file mode 100644
index 3f40e32af5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappedSuperclass.java
+++ /dev/null
@@ -1,63 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
-import org.eclipse.persistence.jpa.jpql.spi.IMappedSuperclass;
-
-/**
- * The concrete implementation of {@link IMappedSuperclass} that is wrapping the design-time
- * representation of a JPA mapped superclass.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaMappedSuperclass extends JpaManagedType
- implements IMappedSuperclass {
-
- /**
- * Creates a new <code>JpaMappedSuperclass</code>.
- *
- * @param provider The provider of JPA managed types
- * @param mappedSuperclass The design-time model object wrapped by this class
- */
- JpaMappedSuperclass(JpaManagedTypeProvider provider, MappedSuperclass mappedSuperclass) {
- super(provider, mappedSuperclass);
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(IManagedTypeVisitor visitor) {
- visitor.visit(this);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- MappedSuperclass getManagedType() {
- return (MappedSuperclass) super.getManagedType();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return getType().getName();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
deleted file mode 100644
index 8152bbdf67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMapping.java
+++ /dev/null
@@ -1,269 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.annotation.Annotation;
-import java.util.List;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.MappingKeys;
-import org.eclipse.jpt.jpa.core.context.AttributeMapping;
-import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
-import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
-import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
-import org.eclipse.persistence.jpa.jpql.spi.IMapping;
-import org.eclipse.persistence.jpa.jpql.spi.IMappingType;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-
-/**
- * The concrete implementation of {@link IMapping} that is wrapping the design-time representation
- * of a mapping.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-final class JpaMapping implements IMapping {
-
- /**
- * The design-time {@link AttributeMapping} wrapped by this class.
- */
- private final AttributeMapping mapping;
-
- /**
- * The type of the actual mapping.
- */
- private IMappingType mappingType;
-
- /**
- * The parent of this mapping.
- */
- private final JpaManagedType parent;
-
- /**
- * The {@link IType} of the property represented by the mapping.
- */
- private IType type;
-
- /**
- * The {@link ITypeDeclaration} of the property represented by the mapping.
- */
- private ITypeDeclaration typeDeclaration;
-
- /**
- * Creates a new <code>JpaMapping</code>.
- *
- * @param parent The parent of this mapping
- * @param mapping The design-time {@link AttributeMapping} wrapped by this class
- */
- JpaMapping(JpaManagedType parent, AttributeMapping mapping) {
- super();
- this.parent = parent;
- this.mapping = mapping;
- }
-
- private ITypeDeclaration[] buildGenericTypeDeclarations() {
- JavaPersistentAttribute javaPersistentAttribute = mapping.getPersistentAttribute().getJavaPersistentAttribute();
- JavaResourceAttribute resource = javaPersistentAttribute.getResourceAttribute();
- List<ITypeDeclaration> declarations = CollectionTools.list(buildGenericTypeDeclarations(resource));
- return declarations.toArray(new ITypeDeclaration[declarations.size()]);
- }
-
- private Iterable<ITypeDeclaration> buildGenericTypeDeclarations(JavaResourceAttribute resource) {
- return new TransformationIterable<String, ITypeDeclaration>(resource.getTypeTypeArgumentNames()) {
- @Override
- protected ITypeDeclaration transform(String next) {
- return getTypeRepository().getType(next).getTypeDeclaration();
- }
- };
- }
-
- private ITypeDeclaration buildTypeDeclaration() {
-
- PersistentAttribute property = mapping.getPersistentAttribute();
- boolean array = property.getTypeName().endsWith("[]");
- int dimensionality = 0;
-
- if (array) {
- dimensionality = getType().getTypeDeclaration().getDimensionality();
- }
-
- return new JpaTypeDeclaration(
- getType(),
- buildGenericTypeDeclarations(),
- dimensionality
- );
- }
-
- /**
- * {@inheritDoc}
- */
- public int compareTo(IMapping mapping) {
- return getName().compareTo(mapping.getName());
- }
-
- /**
- * {@inheritDoc}
- */
- public IMappingType getMappingType() {
- if (mappingType == null) {
- getTypeDeclaration();
- mappingType = mappingType();
- }
- return mappingType;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return mapping.getName();
- }
-
- /**
- * {@inheritDoc}
- */
- public IManagedType getParent() {
- return parent;
- }
-
- /**
- * {@inheritDoc}
- */
- public IType getType() {
- if (type == null) {
- PersistentAttribute property = mapping.getPersistentAttribute();
- type = getTypeRepository().getType(property.getTypeName());
- }
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration getTypeDeclaration() {
- if (typeDeclaration == null) {
- typeDeclaration = buildTypeDeclaration();
- }
- return typeDeclaration;
- }
-
- private JpaTypeRepository getTypeRepository() {
- return parent.getProvider().getTypeRepository();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasAnnotation(Class<? extends Annotation> annotationType) {
- JavaResourceAttribute attribute = mapping.getPersistentAttribute().getJavaPersistentAttribute().getResourceAttribute();
- return attribute.getAnnotation(annotationType.getName()) != null;
- }
-
- private IMappingType mappingType() {
-
- String type = mapping.getKey();
-
- // Basic
- if (type == MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.BASIC;
- }
-
- // Embedded
- if (type == MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.EMBEDDED;
- }
-
- // Embedded Id
- if (type == MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.EMBEDDED_ID;
- }
-
- // Id
- if (type == MappingKeys.ID_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.ID;
- }
-
- // M:M
- if (type == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.MANY_TO_MANY;
- }
-
- // 1:M
- if (type == MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.ONE_TO_MANY;
- }
-
- // M:1
- if (type == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.MANY_TO_ONE;
- }
-
- // 1:1
- if (type == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.ONE_TO_ONE;
- }
-
- // Version
- if (type == MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.VERSION;
- }
-
- // Element Collection
- if (type == MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
- return IMappingType.ELEMENT_COLLECTION;
- }
-
- // Basic Collection
-// if (type == EclipseLinkMappingKeys.BASIC_COLLECTION_ATTRIBUTE_MAPPING_KEY) {
-// return IMappingType.BASIC_COLLECTION;
-// }
-//
-// // Basic Map
-// if (type == EclipseLinkMappingKeys.BASIC_MAP_ATTRIBUTE_MAPPING_KEY) {
-// return IMappingType.BASIC_MAP;
-// }
-//
-// // Transformation
-// if (type == EclipseLinkMappingKeys.TRANSFORMATION_ATTRIBUTE_MAPPING_KEY) {
-// return IMappingType.TRANSFORMATION;
-// }
-//
-// // Variable 1:1
-// if (type == EclipseLinkMappingKeys.VARIABLE_ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY) {
-// return IMappingType.VARIABLE_ONE_TO_ONE;
-// }
-
- return IMappingType.TRANSIENT;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- StringTools.appendSimpleToString(sb, this);
- sb.append(", name=");
- sb.append(getName());
- sb.append(", mappingType=");
- sb.append(getMappingType());
- return sb.toString();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java
deleted file mode 100644
index fa95229d86..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaMappingFile.java
+++ /dev/null
@@ -1,64 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.MappingFile;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-
-/**
- * The concrete implementation that is wrapping the design-time representation of a mapping file.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-public class JpaMappingFile extends JpaManagedTypeProvider {
-
- /**
- * Creates a new <code>JpaMappingFile</code>.
- *
- * @param jpaProject The project that gives access to the application's metadata
- * @param persistentTypeContainer The design-time provider of managed types
- */
- public JpaMappingFile(JpaProject jpaProject, MappingFile persistentTypeContainer) {
- super(jpaProject, persistentTypeContainer);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- JpaEntity buildEntity(TypeMapping mappedClass) {
- return new JpaOrmEntity(this, (Entity) mappedClass);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected MappingFile getPersistentTypeContainer() {
- return (MappingFile) super.getPersistentTypeContainer();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Iterable<? extends PersistentType> persistenceTypes() {
- return getPersistentTypeContainer().getPersistentTypes();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java
deleted file mode 100644
index fcb6384435..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaNullManagedType.java
+++ /dev/null
@@ -1,112 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedType;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeProvider;
-import org.eclipse.persistence.jpa.jpql.spi.IManagedTypeVisitor;
-import org.eclipse.persistence.jpa.jpql.spi.IMapping;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-
-/**
- * The concrete implementation of {@link IManagedType} that is wrapping the design-time
- * representation a "null" managed type.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaNullManagedType implements IManagedType {
-
- /**
- * The provider of JPA managed types.
- */
- private final JpaManagedTypeProvider provider;
-
- /**
- * The cached {@link IType} of this "null" managed type.
- */
- private IType type;
-
- /**
- * The design-time model object wrapped by this class.
- */
- private final TypeMapping typeMapping;
-
- /**
- * Creates a new <code>JpaNullManagedType</code>.
- *
- * @param managedType The provider of JPA managed types
- * @param typeMapping The design-time model object wrapped by this class
- */
- JpaNullManagedType(JpaManagedTypeProvider provider, TypeMapping typeMapping) {
- super();
- this.provider = provider;
- this.typeMapping = typeMapping;
- }
-
- /**
- * {@inheritDoc}
- */
- public void accept(IManagedTypeVisitor visitor) {
- }
-
- /**
- * {@inheritDoc}
- */
- public int compareTo(IManagedType managedType) {
- return getType().getName().compareTo(managedType.getType().getName());
- }
-
- /**
- * {@inheritDoc}
- */
- public IMapping getMappingNamed(String name) {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public IManagedTypeProvider getProvider() {
- return provider;
- }
-
- /**
- * {@inheritDoc}
- */
- public IType getType() {
- if (type == null) {
- type = provider.getTypeRepository().getType(typeMapping.getPersistentType().getName());
- }
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- public Iterable<IMapping> mappings() {
- return EmptyIterable.instance();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return getType().getName();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java
deleted file mode 100644
index 504019c449..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaOrmEntity.java
+++ /dev/null
@@ -1,57 +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.jpa.core.internal.jpql;
-
-import java.util.Map;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
-import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
-import org.eclipse.persistence.jpa.jpql.spi.IQuery;
-
-/**
- * The concrete implementation of {@link IEntity} that is wrapping the design-time representation
- * of a JPA entity defined in an ORM configuration.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaOrmEntity extends JpaEntity {
-
- /**
- * Creates a new <code>JpaOrmEntity</code>.
- *
- * @param provider The provider of JPA managed types
- * @param entity The design-time model object wrapped by this class
- */
- JpaOrmEntity(JpaMappingFile provider, Entity entity) {
- super(provider, entity);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- void initializeQueries(Map<String, IQuery> queries) {
- super.initializeQueries(queries);
-
- JpaManagedTypeProvider provider = getProvider();
- OrmPersistentType type = (OrmPersistentType) getManagedType().getPersistentType();
- JavaTypeMapping mapping = type.getJavaPersistentType().getMapping();
-
- if (mapping instanceof Entity) {
- Entity entity = (Entity) mapping;
- for (NamedQuery namedQuery : entity.getQueryContainer().getNamedQueries()) {
- queries.put(namedQuery.getName(), buildQuery(provider, namedQuery));
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java
deleted file mode 100644
index 4ffa24042a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnit.java
+++ /dev/null
@@ -1,80 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.context.Entity;
-import org.eclipse.jpt.jpa.core.context.PersistentType;
-import org.eclipse.jpt.jpa.core.context.TypeMapping;
-import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-
-/**
- * The concrete implementation that is wrapping the design-time representation of a persistence unit.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-public final class JpaPersistenceUnit extends JpaManagedTypeProvider {
-
- /**
- * Creates a new <code>JpaPersistenceUnit</code>.
- *
- * @param jpaProject The project that gives access to the application's metadata
- * @param persistentUnit The design-time persistence unit
- */
- public JpaPersistenceUnit(JpaProject jpaProject, PersistenceUnit persistentUnit) {
- super(jpaProject, persistentUnit);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- JpaEntity buildEntity(TypeMapping mappedClass) {
- return new JpaPersistenceUnitEntity(this, (Entity) mappedClass);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- PersistenceUnit getPersistentTypeContainer() {
- return (PersistenceUnit) super.getPersistentTypeContainer();
- }
-
- @SuppressWarnings("unchecked")
- private Iterable<ClassRef> javaClassRefs() {
- return new CompositeIterable<ClassRef>(
- getPersistentTypeContainer().getSpecifiedClassRefs(),
- getPersistentTypeContainer().getImpliedClassRefs()
- );
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- Iterable<? extends PersistentType> persistenceTypes() {
- return new TransformationIterable<ClassRef, PersistentType>(javaClassRefs()) {
- @Override
- protected PersistentType transform(ClassRef classRef) {
- return classRef.getJavaPersistentType();
- }
- };
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnitEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnitEntity.java
deleted file mode 100644
index c552d877ce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaPersistenceUnitEntity.java
+++ /dev/null
@@ -1,33 +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.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.jpa.core.context.Entity;
-
-/**
- * The concrete implementation of {@link IEntity} that is wrapping the design-time representation
- * of a JPA entity defined in a persistence unit.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaPersistenceUnitEntity extends JpaEntity {
-
- /**
- * Creates a new <code>JpaPersistenceUnitEntity</code>.
- *
- * @param provider The provider of JPA managed types
- * @param entity The design-time model object wrapped by this class
- */
- JpaPersistenceUnitEntity(JpaManagedTypeProvider provider, Entity entity) {
- super(provider, entity);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java
deleted file mode 100644
index 45d4f2fb14..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaQuery.java
+++ /dev/null
@@ -1,115 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.context.NamedQuery;
-import org.eclipse.persistence.jpa.jpql.spi.IQuery;
-
-/**
- * The concrete implementation of {@link IQuery} that is wrapping the design-time representation
- * of a JPQL query.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-public final class JpaQuery implements IQuery {
-
- /**
- * The actual JPQL query, which can differ from the one owned by the model object, which happens
- * when the model is out of sync because it has not been updated yet.
- */
- private String actualQuery;
-
- /**
- * The provider of managed types.
- */
- private JpaManagedTypeProvider provider;
-
- /**
- * The model object holding onto the JPQL query.
- */
- private NamedQuery query;
-
- /**
- * Creates a new <code>JpaQuery</code>.
- *
- * @param provider The provider of managed types
- * @param query The model object of the JPQL query
- */
- public JpaQuery(JpaManagedTypeProvider provider, NamedQuery query) {
- this(provider, query, query.getQuery());
- }
-
- /**
- * Creates a new <code>JpaQuery</code>.
- *
- * @param provider The provider of managed types
- * @param query The model object of the JPQL query
- * @param actualQuery The actual JPQL query, which can differ from the one owned by the model
- * object, which happens when the model is out of sync because it has not been updated yet
- */
- JpaQuery(JpaManagedTypeProvider provider, NamedQuery query, String actualQuery) {
- super();
- initialize(provider, query, actualQuery);
- }
-
- /**
- * {@inheritDoc}
- */
- public String getExpression() {
- return actualQuery;
- }
-
- /**
- * {@inheritDoc}
- */
- public JpaManagedTypeProvider getProvider() {
- return provider;
- }
-
- /**
- * Returns the encapsulated {@link NamedQuery}, which is the actual object.
- *
- * @return The design-time representation of a JPQL query
- */
- NamedQuery getQuery() {
- return query;
- }
-
- private void initialize(JpaManagedTypeProvider provider, NamedQuery query, String actualQuery) {
-
- this.query = query;
- this.provider = provider;
- this.actualQuery = actualQuery;
-
- if (this.actualQuery == null) {
- this.actualQuery = StringTools.EMPTY_STRING;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(super.toString());
- sb.append(", query=");
- sb.append(getExpression());
- return sb.toString();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java
deleted file mode 100644
index 3e12d029c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaType.java
+++ /dev/null
@@ -1,430 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.jdt.core.dom.ClassInstanceCreation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
-import org.eclipse.jdt.core.dom.IMethodBinding;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.NodeFinder;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.persistence.jpa.jpql.ExpressionTools;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-
-/**
- * The concrete implementation of {@link org.eclipse.persistence.jpa.query.spi.IType IType} that is
- * wrapping the design-time representation of a Java type.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaType implements IJpaType {
-
- /**
- * The cached collection of {@link IConstructor constructors}.
- */
- private Collection<IConstructor> constructors;
-
- /**
- * The list of names for the {@link Enum}'s constants otherwise an empty array.
- */
- private String[] enumConstants;
-
- /**
- * The design-time representation of a Java type.
- */
- private IType type;
-
- /**
- * The {@link ITypeBinding} for the type, which is the information that was resolved and which
- * can be used to query information about that type.
- */
- private ITypeBinding typeBinding;
-
- /**
- * This flag makes sure to not try more than once resolving the {@link ITypeBinding} if it fails
- * the first time.
- */
- private boolean typeBindingResolved;
-
- /**
- * Caches the type hierarchy of the {@link IType} in order to prevent rebuilding it each time.
- */
- private ITypeDeclaration typeDeclaration;
-
- /**
- * Caches the type hierarchy of the {@link IType} in order to prevent rebuilding it each time
- * {@link #isAssignableTo(org.eclipse.persistence.jpa.query.spi.IType)} is called.
- */
- private ITypeHierarchy typeHierarchy;
-
- /**
- * The fully qualified name of the Java type.
- */
- private final String typeName;
-
- /**
- * The external form of a type repository.
- */
- private final JpaTypeRepository typeRepository;
-
- /**
- * Creates a new <code>JpaType</code>.
- *
- * @param typeRepository The external form of a type repository
- * @param type The design-time representation of a Java type
- */
- JpaType(JpaTypeRepository typeRepository, IType type) {
- super();
- this.type = type;
- this.typeName = type.getFullyQualifiedName();
- this.typeRepository = typeRepository;
- }
-
- private CompilationUnit buildCompilationUnit() {
-
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setSource(type.getTypeRoot());
- parser.setIgnoreMethodBodies(true);
- parser.setResolveBindings(true);
- parser.setBindingsRecovery(true);
-
- return (CompilationUnit) parser.createAST(new NullProgressMonitor());
- }
-
- private Collection<IConstructor> buildConstructors() {
-
- ITypeBinding typeBinding = getTypeBinding();
-
- // No Java source is attached to the Java class file, parse the class with a reader
- if ((typeBinding == null) && type.isBinary()) {
- Collection<IConstructor> constructors = new ArrayList<IConstructor>();
-
- try {
- // Root types
- for (IJavaElement rootType : type.getTypeRoot().getChildren()) {
- // Root type
- if (rootType.getElementType() == IJavaElement.TYPE) {
- for (IJavaElement javaElement : ((IType) rootType).getChildren()) {
- // Method
- if (javaElement.getElementType() == IJavaElement.METHOD) {
- IMethod method = (IMethod) javaElement;
- // Constructor
- if (method.isConstructor()) {
- constructors.add(new ClassConstructor(this, method));
- }
- }
- }
- }
- }
- }
- catch (Exception e) {
- JptJpaCorePlugin.log(e);
- }
-
- return constructors;
- }
- // Use the ITypeBinding to retrieve the constructors
- else if (typeBinding != null) {
- Collection<IConstructor> constructors = new ArrayList<IConstructor>();
-
- for (IMethodBinding method : typeBinding.getDeclaredMethods()) {
- if (method.isConstructor()) {
- constructors.add(new JpaConstructor(this, method));
- }
- }
-
- return constructors;
- }
-
- return Collections.emptyList();
- }
-
- private String[] buildEnumConstants() {
-
- try {
- // Retrieve the enum constants from IType
- if (type.isEnum()) {
- List<String> names = new ArrayList<String>();
-
- for (IField field : type.getFields()) {
- if (field.isEnumConstant()) {
- names.add(field.getElementName());
- }
- }
-
- return names.toArray(new String[names.size()]);
- }
- }
- catch (Exception e) {
- // Just ignore and return an empty array
- }
-
- return ExpressionTools.EMPTY_STRING_ARRAY;
- }
-
- private ITypeBinding buildTypeBinding() {
-
- // This code was copied from ASTNodes.getTypeBinding(CompilationUnit, IType)
- try {
- CompilationUnit compilationUnit = buildCompilationUnit();
-
- if (type.isAnonymous()) {
- IJavaElement parent = type.getParent();
-
- if ((parent instanceof IField) && Flags.isEnum(((IMember) parent).getFlags())) {
- ASTNode node = NodeFinder.perform(compilationUnit, type.getNameRange());
- EnumConstantDeclaration constant = (EnumConstantDeclaration) node;
-
- if (constant != null) {
- AnonymousClassDeclaration declaration = constant.getAnonymousClassDeclaration();
-
- if (declaration != null) {
- return declaration.resolveBinding();
- }
- }
- }
- else {
- ASTNode node = NodeFinder.perform(compilationUnit, type.getNameRange());
- ClassInstanceCreation creation = (ClassInstanceCreation) getParent(node, ClassInstanceCreation.class);
-
- if (creation != null) {
- return creation.resolveTypeBinding();
- }
- }
- }
- else {
- ASTNode node = NodeFinder.perform(compilationUnit, type.getNameRange());
- AbstractTypeDeclaration declaration = (AbstractTypeDeclaration) getParent(node, AbstractTypeDeclaration.class);
-
- if (declaration != null) {
- return declaration.resolveBinding();
- }
- }
- }
- catch (Exception e) {
- // Simply ignore
- }
-
- return null;
- }
-
- private ITypeDeclaration buildTypeDeclaration() {
- return new JpaTypeDeclaration(this, new ITypeDeclaration[0]);
- }
-
- /**
- * {@inheritDoc}
- */
- public Iterable<IConstructor> constructors() {
- if (constructors == null) {
- constructors = buildConstructors();
- }
- return constructors;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object object) {
- return (this == object) || equals((org.eclipse.persistence.jpa.jpql.spi.IType) object);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(org.eclipse.persistence.jpa.jpql.spi.IType type) {
- return (this == type) || typeName.equals(type.getName());
- }
-
- /**
- * {@inheritDoc}
- */
- public String[] getEnumConstants() {
- if (enumConstants == null) {
- enumConstants = buildEnumConstants();
- }
- return enumConstants;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return typeName;
- }
-
- private ASTNode getParent(ASTNode node, Class<? extends ASTNode> parentClass) {
-
- do {
- node = node.getParent();
- }
- while ((node != null) && !parentClass.isInstance(node));
-
- return node;
- }
-
- /**
- * Returns the encapsulated {@link Type}, which is the actual type.
- *
- * @return The design-time representation of a Java type
- */
- IType getType() {
- return type;
- }
-
- private ITypeBinding getTypeBinding() {
- if ((typeBinding == null) && !typeBindingResolved) {
- typeBinding = buildTypeBinding();
- typeBindingResolved = true;
- }
- return typeBinding;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration getTypeDeclaration() {
- if (typeDeclaration == null) {
- typeDeclaration = buildTypeDeclaration();
- }
- return typeDeclaration;
- }
-
- /**
- * Returns the repository that gives access to the application's classes.
- *
- * @return The external form of the type repository
- */
- JpaTypeRepository getTypeRepository() {
- return typeRepository;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasAnnotation(Class<? extends Annotation> annotationType) {
- return type.getAnnotation(annotationType.getName()) != null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- return typeName.hashCode();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAssignableTo(org.eclipse.persistence.jpa.jpql.spi.IType otherType) {
-
- if (this == otherType) {
- return true;
- }
-
- String otherTypeName = otherType.getName();
-
- // Type hierarchy for Java compiled classes
- ITypeBinding typeBinding = getTypeBinding();
-
- // Type hierarchy for Class files
- if ((typeBinding == null) && type.isBinary()) {
-
- // First create the type hierarchy
- if (typeHierarchy == null) {
- try {
- typeHierarchy = type.newSupertypeHierarchy(new NullProgressMonitor());
- }
- catch (Exception e) {
- return false;
- }
- }
-
- // Now check if the other type name is in the type hierarchy
- for (IType superType : typeHierarchy.getAllTypes()) {
- if (superType.getFullyQualifiedName().equals(otherTypeName)) {
- return true;
- }
- }
- }
- // Type hierarchy for Java source files
- else if (typeBinding != null) {
- return ASTTools.typeIsSubTypeOf(typeBinding, otherTypeName);
- }
-
- // Anything else is always false
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isEnum() {
- try {
- return type.isEnum();
- }
- catch (Exception e) {
- // Simply ignore and return no
- return false;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isResolvable() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setTypeDeclaration(JpaTypeDeclaration typeDeclaration) {
- this.typeDeclaration = typeDeclaration;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return StringTools.buildToStringFor(this, typeName);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java
deleted file mode 100644
index 7927bb9d3f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeDeclaration.java
+++ /dev/null
@@ -1,105 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-
-/**
- * The concrete implementation of {@link ITypeDeclaration} that is wrapping the design-time
- * representation of the declaration description of a type.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class JpaTypeDeclaration implements ITypeDeclaration {
-
- /**
- * The dimensionality of the array or 0 if the type is not an array.
- */
- private int dimensionality;
-
- /**
- * The generics of the given type or an empty list if the type is not parameterized.
- */
- private final ITypeDeclaration[] genericTypes;
-
- /**
- * The external form of the Java type.
- */
- private final IType type;
-
- /**
- * Creates a new <code>JpaTypeDeclaration</code>.
- *
- * @param type The external form of the Java type
- * @param genericTypes The generics of the given type or an empty list if the type is not
- * parameterized
- */
- JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes) {
- this(type, genericTypes, 0);
- }
-
- /**
- * Creates a new <code>JpaTypeDeclaration</code>.
- *
- * @param type The external form of the Java type
- * @param genericTypes The generics of the given type or an empty list if the type is not
- * parameterized
- * @param dimensionality The dimensionality of the array or 0 if it's not an array
- */
- JpaTypeDeclaration(IType type, ITypeDeclaration[] genericTypes, int dimensionality) {
- super();
- this.type = type;
- this.genericTypes = genericTypes;
- this.dimensionality = dimensionality;
- }
-
- /**
- * {@inheritDoc}
- */
- public int getDimensionality() {
- return dimensionality;
- }
-
- /**
- * {@inheritDoc}
- */
- public IType getType() {
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration[] getTypeParameters() {
- return genericTypes;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isArray() {
- return dimensionality > 0;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return type.getName();
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java
deleted file mode 100644
index ece1dbd131..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/JpaTypeRepository.java
+++ /dev/null
@@ -1,404 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.persistence.jpa.jpql.TypeHelper;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeRepository;
-
-/**
- * The concrete implementation of {@link ITypeRepository} that is wrapping the design-time
- * representation of a type repository.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-@SuppressWarnings("nls")
-final class JpaTypeRepository implements ITypeRepository {
-
- /**
- * The Java project that gives access the design-time objects representing the Java types.
- */
- private final IJavaProject javaProject;
-
- /**
- * Keeps a map of the primitives for fast access.
- */
- private Map<String, Class<?>> primitives;
-
- /**
- * The cached helper that is using this repository for retrieving {@link IJpaType types}.
- */
- private TypeHelper typeHelper;
-
- /**
- * The types that have been cached for faster access.
- */
- private final Map<String, IJpaType> types;
-
- /**
- * The {@link IJpaType} that represents a unresolvable or simply an unknown type, which is created
- * when {@link #getType(String)} is invoked with {@link IJpaType#UNRESOLVABLE_TYPE}.
- */
- private IJpaType unresolvableType;
-
- /**
- * Creates a new <code>JpaTypeRepository</code>.
- *
- * @param javaProject The Java project that gives access the design-time objects representing
- * the Java types
- */
- JpaTypeRepository(IJavaProject javaProject) {
- super();
- this.javaProject = javaProject;
- this.types = new HashMap<String, IJpaType>();
- }
-
- private String buildInnerTypeName(String typeName, int index) {
- StringBuilder sb = new StringBuilder();
- sb.append(typeName.substring(0, index));
- sb.append("$");
- sb.append(typeName.substring(index + 1, typeName.length()));
- return sb.toString();
- }
-
- private Map<String, Class<?>> buildPrimitives() {
- Map<String, Class<?>> primitives = new HashMap<String, Class<?>>();
- primitives.put(Byte .TYPE.getName(), Byte .TYPE);
- primitives.put(Short .TYPE.getName(), Short .TYPE);
- primitives.put(Character.TYPE.getName(), Character.TYPE);
- primitives.put(Integer .TYPE.getName(), Integer .TYPE);
- primitives.put(Long .TYPE.getName(), Long .TYPE);
- primitives.put(Float .TYPE.getName(), Float .TYPE);
- primitives.put(Double .TYPE.getName(), Double .TYPE);
- primitives.put(Boolean .TYPE.getName(), Boolean .TYPE);
- return primitives;
- }
-
- private IJpaType buildType(Class<?> javaType) {
- JavaType jpaType = new JavaType(this, javaType);
- types.put(jpaType.getName(), jpaType);
- return jpaType;
- }
-
- private IJpaType buildType(IType type) {
- JpaType jpaType = new JpaType(this, type);
- types.put(jpaType.getName(), jpaType);
- return jpaType;
- }
-
- private IJpaType buildType(String typeName) {
- IJpaType jpaType = new SimpleType(this, typeName);
- types.put(typeName, jpaType);
- return jpaType;
- }
-
- private String convertToJavaArrayType(String typeName) {
-
- int index = typeName.indexOf("[]");
- int dimensionality = (typeName.length() - index) / 2;
- StringBuilder sb = new StringBuilder();
-
- while (dimensionality-- > 0) {
- sb.append("[");
- }
-
- String type = typeName.substring(0, index);
- Class<?> primitive = primitives.get(type);
-
- if (primitive != null) {
- if (primitive == Byte.TYPE) {
- sb.append("B");
- }
- else if (primitive == Character.TYPE) {
- sb.append("C");
- }
- else if (primitive == Short.TYPE) {
- sb.append("S");
- }
- else if (primitive == Integer.TYPE) {
- sb.append("I");
- }
- else if (primitive == Long.TYPE) {
- sb.append("L");
- }
- else if (primitive == Float.TYPE) {
- sb.append("F");
- }
- else if (primitive == Double.TYPE) {
- sb.append("D");
- }
- else if (primitive == Boolean.TYPE) {
- sb.append("Z");
- }
- }
- else {
- sb.append(type);
- sb.append(";");
- }
-
- return sb.toString();
- }
-
- private Class<?> findPrimitive(String typeName) {
- if (primitives == null) {
- primitives = buildPrimitives();
- }
- return primitives.get(typeName);
- }
-
- /**
- * Retrieves the design-time Java type for the given type name, which has to be the fully
- * qualified type name.
- *
- * @param typeName The fully qualified type name
- * @return The design-time Java type if it could be retrieved; <code>null</code> otherwise
- */
- IType findType(String typeName) {
- try {
- return javaProject.findType(typeName);
- }
- catch (JavaModelException e) {
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public IJpaType getEnumType(String enumTypeName) {
-
- // Get the position of the last dot so the enum constant can be removed
- int lastDotIndex = enumTypeName.lastIndexOf(".");
-
- if (lastDotIndex == -1) {
- return null;
- }
-
- // Retrieve the fully qualified enum type name
- String typeName = enumTypeName.substring(0, lastDotIndex);
-
- // Attempt to load the enum type
- IType type = findType(typeName);
- IJpaType jpaType;
-
- if (type != null) {
- jpaType = buildType(type);
- }
- else {
- jpaType = loadInnerType(typeName);
- }
-
- return (jpaType != null) && jpaType.isEnum() ? jpaType : null;
- }
-
- /**
- * Returns the Java project, which gives access to the class path.
- *
- * @return The Java project, which gives access to the class path
- */
- IJavaProject getJavaProject() {
- return javaProject;
- }
-
- /**
- * {@inheritDoc}
- */
- public IJpaType getType(Class<?> javaClass) {
- IJpaType type = types.get(javaClass.getName());
- if (type == null) {
- type = buildType(javaClass);
- }
- return type;
- }
-
- /**
- * Retrieves the {@link IType} for the given {@link IResource}.
- *
- * @param resource The workspace location of the {@link IType} to retrieve
- * @return The design-time representation of a Java type
- */
- IType getType(IResource resource) {
- try {
- return (IType) javaProject.findElement((IPath) resource);
- }
- catch (Exception e) {
- return null;
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public IJpaType getType(String typeName) {
-
- if (IJpaType.UNRESOLVABLE_TYPE == typeName) {
- return unresolvableType();
- }
-
- if (typeName.endsWith("[]")) {
- return loadArrayType(typeName);
- }
-
- if (typeName.charAt(0) == '[') {
- return loadJavaArrayType(typeName);
- }
-
- return loadTypeImp(typeName);
- }
-
- /**
- * {@inheritDoc}
- */
- public TypeHelper getTypeHelper() {
- if (typeHelper == null) {
- typeHelper = new TypeHelper(this);
- }
- return typeHelper;
- }
-
- private IJpaType loadArrayType(String typeName) {
-
- IJpaType type = types.get(typeName);
-
- if (type == null) {
- try {
- // Try to see if the type is a JDK class, otherwise, just use the type name
- // since IJpaType doesn't support array types
- String javaTypeName = convertToJavaArrayType(typeName);
- type = buildType(Class.forName(javaTypeName));
- }
- catch (Exception e) {
-
- int index = typeName.indexOf("[]");
- int dimensionality = (typeName.length() - index) / 2;
-
- type = getType(typeName.substring(0, index));
-
- type.setTypeDeclaration(
- new JpaTypeDeclaration(type, new ITypeDeclaration[0], dimensionality)
- );
- }
-
- types.put(typeName, type);
- }
-
- return type;
- }
-
- private IJpaType loadInnerType(String typeName) {
-
- while (true) {
-
- int index = typeName.lastIndexOf(".");
-
- if (index == -1) {
- return null;
- }
-
- typeName = buildInnerTypeName(typeName, index);
- IJpaType cachedType = types.get(typeName);
-
- if (cachedType != null) {
- return cachedType;
- }
-
- // Attempt to load the Java type
- IType type = findType(typeName);
-
- // A Java type exists, return it
- if (type != null) {
- return buildType(type);
- }
- }
- }
-
- private IJpaType loadJavaArrayType(String typeName) {
-
- IJpaType type = types.get(typeName);
-
- if (type == null) {
- try {
- // Try to see if the type is a JDK class, otherwise, just use the type name
- // since IJpaType doesn't support array types
- type = buildType(Class.forName(typeName));
- }
- catch (Exception e) {
-
- int index = typeName.lastIndexOf("[");
- int dimensionality = index / 2;
-
- type = getType(typeName.substring(index, typeName.endsWith(";") ? typeName.length() - 1 : typeName.length()));
-
- type.setTypeDeclaration(
- new JpaTypeDeclaration(type, new ITypeDeclaration[0], dimensionality)
- );
- }
-
- types.put(typeName, type);
- }
-
- return type;
- }
-
- private IJpaType loadTypeImp(String typeName) {
-
- IJpaType type = types.get(typeName);
-
- // The type was already cached, simply return it
- if (type != null) {
- return type;
- }
-
- // First check for primitive, they don't have a corresponding IJpaType
- Class<?> primitive = findPrimitive(typeName);
-
- if (primitive != null) {
- return buildType(primitive);
- }
-
- // Attempt to load the Java type
- IType iType = findType(typeName);
-
- // A Java type exists, return it
- if (iType != null) {
- return buildType(iType);
- }
-
- // Now try with a possible inner enum type
- type = loadInnerType(typeName);
-
- // No Java type exists, create a "null" IJpaType
- if (type == null) {
- type = buildType(typeName);
- }
-
- return type;
- }
-
- private IJpaType unresolvableType() {
- if (unresolvableType == null) {
- unresolvableType = new SimpleType(this, IJpaType.UNRESOLVABLE_TYPE);
- }
- return unresolvableType;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java
deleted file mode 100644
index b30248266e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpql/SimpleType.java
+++ /dev/null
@@ -1,138 +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 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * Oracle - initial API and implementation
- *
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.jpql;
-
-import java.lang.annotation.Annotation;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.persistence.jpa.jpql.spi.IConstructor;
-import org.eclipse.persistence.jpa.jpql.spi.IType;
-import org.eclipse.persistence.jpa.jpql.spi.ITypeDeclaration;
-
-/**
- * The concrete implementation of {@link IType} that is wrapping the type name only.
- *
- * @version 3.0
- * @since 3.0
- * @author Pascal Filion
- */
-final class SimpleType implements IJpaType {
-
- /**
- * Caches the type hierarchy of the {@link IType} in order to prevent rebuilding it each time.
- */
- private ITypeDeclaration typeDeclaration;
-
- /**
- * The fully qualified name of the Java type.
- */
- private final String typeName;
-
- /**
- * The external form of a type repository.
- */
- private final JpaTypeRepository typeRepository;
-
- /**
- * Creates a new <code>SimpleType</code>.
- *
- * @param typeName The fully qualified name of the Java type
- */
- SimpleType(JpaTypeRepository typeRepository, String typeName) {
- super();
- this.typeRepository = typeRepository;
- this.typeName = typeName;
- }
-
- /**
- * {@inheritDoc}
- */
- public Iterable<IConstructor> constructors() {
- return EmptyIterable.instance();
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean equals(IType type) {
- return typeName.equals(type.getName());
- }
-
- /**
- * {@inheritDoc}
- */
- public String[] getEnumConstants() {
- return StringTools.EMPTY_STRING_ARRAY;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return typeName;
- }
-
- /**
- * {@inheritDoc}
- */
- public ITypeDeclaration getTypeDeclaration() {
- if (typeDeclaration == null) {
- typeDeclaration = new JpaTypeDeclaration(this, new ITypeDeclaration[0]);
- }
- return typeDeclaration;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasAnnotation(Class<? extends Annotation> annotationType) {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isAssignableTo(IType type) {
- return typeRepository.equals(type.getName());
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isEnum() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isResolvable() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setTypeDeclaration(JpaTypeDeclaration typeDeclaration) {
- this.typeDeclaration = typeDeclaration;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString() {
- return typeName;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java
deleted file mode 100644
index 1414a3b681..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.libprov;
-
-import org.eclipse.jpt.common.core.internal.libprov.JptOsgiBundlesLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-
-public class JpaOsgiBundlesLibraryProviderInstallOperationConfig
- extends JptOsgiBundlesLibraryProviderInstallOperationConfig
- implements JpaLibraryProviderInstallOperationConfig {
-
- private JpaPlatformDescription jpaPlatform;
-
-
- public JpaOsgiBundlesLibraryProviderInstallOperationConfig() {
- super();
- }
-
- public JpaPlatformDescription getJpaPlatform() {
- return this.jpaPlatform;
- }
-
- public void setJpaPlatform(JpaPlatformDescription jpaPlatform) {
- JpaPlatformDescription old = this.jpaPlatform;
- this.jpaPlatform = jpaPlatform;
- notifyListeners(PROP_JPA_PLATFORM, old, jpaPlatform);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java
deleted file mode 100644
index 9f28287e06..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.libprov;
-
-import org.eclipse.jpt.common.core.internal.libprov.JptUserLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-
-public class JpaUserLibraryProviderInstallOperationConfig
- extends JptUserLibraryProviderInstallOperationConfig
- implements JpaLibraryProviderInstallOperationConfig {
-
- private JpaPlatformDescription jpaPlatform;
-
-
- public JpaUserLibraryProviderInstallOperationConfig() {
- super();
- }
-
-
- public JpaPlatformDescription getJpaPlatform() {
- return this.jpaPlatform;
- }
-
- public void setJpaPlatform(JpaPlatformDescription jpaPlatform) {
- JpaPlatformDescription old = this.jpaPlatform;
- this.jpaPlatform = jpaPlatform;
- notifyListeners(PROP_JPA_PLATFORM, old, jpaPlatform);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java
deleted file mode 100644
index 1a7c1eca30..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.libprov;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider;
-import org.eclipse.jst.common.project.facet.core.libprov.LegacyLibraryProviderDetector;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-
-public class LegacyJpaLibraryProviderDetector
- extends LegacyLibraryProviderDetector
-{
- public static final String LEGACY_JPA_LIBRARY_PROVIDER_ID
- = "jpa-legacy-library-provider"; //$NON-NLS-1$
-
-
- @Override
- public ILibraryProvider detect(
- final IProject project, final IProjectFacet facet) {
- if (facet.equals(JpaFacet.FACET)) {
- return LibraryProviderFramework.getProvider(LEGACY_JPA_LIBRARY_PROVIDER_ID);
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java
deleted file mode 100644
index 996c67dcfd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.libprov;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperation;
-import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig;
-
-public class LegacyJpaLibraryProviderUninstallOperation
- extends LibraryProviderOperation
-{
- @Override
- public void execute(
- LibraryProviderOperationConfig config, IProgressMonitor monitor)
- throws CoreException {
- // no op - nothing to uninstall
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java
deleted file mode 100644
index 71e7bf352b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.libval;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.core.libval.LibraryValidator;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
-import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig;
-import org.eclipse.jst.common.project.facet.core.libprov.osgi.BundleReference;
-import org.eclipse.osgi.service.resolver.VersionRange;
-import org.eclipse.osgi.util.NLS;
-import org.osgi.framework.Bundle;
-
-public abstract class AbstractOsgiBundlesLibraryValidator
- implements LibraryValidator {
-
- protected IStatus validate(
- JpaOsgiBundlesLibraryProviderInstallOperationConfig config,
- Map<String, VersionRange[]> bundleVersionRanges) {
-
- Map<String, Bundle> bundles = new HashMap<String, Bundle>();
-
- for (BundleReference bundleRef : config.getBundleReferences()) {
- for (String bundleName : bundleVersionRanges.keySet()) {
- // if we've gotten here, the bundle references are resolvable
- if (bundleRef.getBundle().getSymbolicName().equals(bundleName)) {
- bundles.put(bundleName, bundleRef.getBundle());
- }
- }
- }
-
- for (String bundleName : bundleVersionRanges.keySet()) {
- if (bundles.get(bundleName) == null) {
- String message
- = NLS.bind(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND, bundleName);
- return new Status(IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, message);
- }
- }
-
- for (String bundleName : bundleVersionRanges.keySet()) {
- Bundle bundle = bundles.get(bundleName);
- for (VersionRange versionRange : bundleVersionRanges.get(bundleName)) {
- if (! versionRange.isIncluded(bundle.getVersion())) {
- String message
- = NLS.bind(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION, bundleName);
- return new Status(IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, message);
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java
deleted file mode 100644
index 93e8012aab..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.libval;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig;
-import org.eclipse.osgi.service.resolver.VersionRange;
-
-public class GenericEclipseLinkBundlesLibraryValidator
- extends AbstractOsgiBundlesLibraryValidator {
-
- public IStatus validate(JptLibraryProviderInstallOperationConfig config) {
- JpaOsgiBundlesLibraryProviderInstallOperationConfig jpaConfig
- = (JpaOsgiBundlesLibraryProviderInstallOperationConfig) config;
- Map<String, VersionRange[]> bundleVersionRanges = new HashMap<String, VersionRange[]>();
- String bundleName = "javax.persistence"; //$NON-NLS-1$
- VersionRange[] versionRanges = new VersionRange[0];
- if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_1_0)) {
- versionRanges = new VersionRange[] {new VersionRange("[1.0, 3.0)")}; //$NON-NLS-1$
- }
- else if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_2_0)) {
- versionRanges = new VersionRange[] {new VersionRange("[2.0, 3.0)")}; //$NON-NLS-1$
- }
- bundleVersionRanges.put(bundleName, versionRanges);
- return validate(jpaConfig, bundleVersionRanges);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java
deleted file mode 100644
index 6c7c9de652..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java
+++ /dev/null
@@ -1,46 +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.jpa.core.internal.libval;
-
-import java.util.HashSet;
-import java.util.Set;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jpt.common.core.internal.libval.LibValUtil;
-import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig;
-import org.eclipse.jpt.common.core.libval.LibraryValidator;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.internal.libprov.JpaUserLibraryProviderInstallOperationConfig;
-
-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$
- }
-
- Iterable<IPath> libraryPaths =
- new TransformationIterable<IClasspathEntry, IPath>(jpaConfig.resolve()) {
- @Override
- protected IPath transform(IClasspathEntry o) {
- return o.getPath();
- }
- };
-
- return LibValUtil.validate(libraryPaths, classNames);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java
deleted file mode 100644
index 1ab0a16337..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.operations;
-
-import java.util.Set;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.internal.operations.AbstractJptFileCreationDataModelProvider;
-import org.eclipse.jpt.common.core.resource.ResourceLocator;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-
-public abstract class AbstractJpaFileCreationDataModelProvider
- extends AbstractJptFileCreationDataModelProvider
- implements JpaFileCreationDataModelProperties
-{
- protected AbstractJpaFileCreationDataModelProvider() {
- super();
- }
-
-
- @Override
- public Set<String> getPropertyNames() {
- Set<String> propertyNames = super.getPropertyNames();
- propertyNames.add(VERSION);
- return propertyNames;
- }
-
- @Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(VERSION)) {
- return getDefaultVersion();
- }
- return super.getDefaultProperty(propertyName);
- }
-
- protected abstract String getDefaultVersion();
-
-
- // **************** validation *********************************************
-
- @Override
- public IStatus validate(String propertyName) {
- IStatus status = super.validate(propertyName);
- if (! status.isOK()) {
- return status;
- }
- if (propertyName.equals(CONTAINER_PATH)
- || propertyName.equals(VERSION)) {
- status = validateVersion();
- }
- if (! status.isOK()) {
- return status;
- }
-
- return status;
- }
-
- @Override
- protected IStatus validateContainerPathAndFileName() {
- IStatus status = super.validateContainerPathAndFileName();
- if (! status.isOK()) {
- return status;
- }
- IContainer container = getContainer();
- IProject project = getProject(container);
- if (! JpaFacet.isInstalled(project)) {
- // verifies project has jpa facet
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_PROJECT_NOT_JPA);
- }
- if (! hasSupportedPlatform(project)) {
- // verifies project has platform that supports this file type
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_PROJECT_IMPROPER_PLATFORM);
- }
- ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(project);
- if (resourceLocator != null /* should never be null, but there might be crazy circumstances */
- && ! resourceLocator.acceptResourceLocation(project, container)) {
- return new Status(
- IStatus.WARNING, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_CONTAINER_QUESTIONABLE);
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus validateVersion() {
- if (getProject() == null) {
- return Status.OK_STATUS;
- }
- String fileVersion = getStringProperty(VERSION);
- if (! fileVersionSupported(fileVersion)) {
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED);
- }
- try {
- String jpaFacetVersion = getJpaFacetVersion(getProject());
- if (! fileVersionSupportedForFacetVersion(fileVersion, jpaFacetVersion)) {
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION);
- }
- }
- catch (CoreException ce) {
- // project should have been validated already, so assume that this will never get hit
- // fall through to final return
- }
- return Status.OK_STATUS;
- }
-
- protected abstract boolean fileVersionSupported(String fileVersion);
-
- protected abstract boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion);
-
-
- // **************** helper methods *****************************************
-
- protected JpaProject getJpaProject() {
- return getJpaProject(getProject());
- }
-
- protected JpaProject getJpaProject(IProject project) {
- return (project == null) ? null : JptJpaCorePlugin.getJpaProject(project);
- }
-
- protected String getJpaFacetVersion(IProject project) throws CoreException {
- IFacetedProject fproj = ProjectFacetsManager.create(project);
- return fproj.getProjectFacetVersion(JpaFacet.FACET).getVersionString();
- }
-
- protected boolean hasSupportedPlatform(IProject project) {
- JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
- return (jpaProject != null) && isSupportedPlatformId(jpaProject.getJpaPlatform().getId());
- }
-
- protected boolean isSupportedPlatformId(@SuppressWarnings("unused") String id) {
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java
deleted file mode 100644
index e27c9479b5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.operations;
-
-
-import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.*;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public abstract class AbstractJpaFileCreationOperation
- extends AbstractDataModelOperation
-{
- /**
- * Will be null until container is created or verified to exist
- */
- protected IContainer container;
-
- /**
- * Will be null until file is created or verified to exist
- */
- protected IFile file;
-
-
- protected AbstractJpaFileCreationOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
-
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- SubMonitor sm = SubMonitor.convert(monitor, 5);
- // Create folder if it does not exist
- createContainer(sm.newChild(1));
- // Create file
- createFile(sm.newChild(4));
- return OK_STATUS;
- }
-
- protected IContainer getContainer() throws ExecutionException {
- IPath containerPath = (IPath) getDataModel().getProperty(CONTAINER_PATH);
- IContainer container = PlatformTools.getContainer(containerPath);
- if (container == null) {
- throw new ExecutionException("No container path specified"); //$NON-NLS-1$
- }
- return container;
- }
-
- protected IProject getProject() throws ExecutionException {
- return getContainer().getProject();
- }
-
- protected JpaProject getJpaProject() throws ExecutionException {
- IProject project = getProject();
- JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
- if (jpaProject == null) {
- throw new ExecutionException("Project does not have JPA facet"); //$NON-NLS-1$
- }
- return jpaProject;
- }
-
- /**
- * This method will create the container as specified in the data model if it does not exist.
- */
- protected void createContainer(IProgressMonitor monitor) throws ExecutionException {
- IContainer container = getContainer();
- if (! container.exists()) {
- if (container.getType() == IContainer.PROJECT) {
- throw new ExecutionException("Project does not exist");
- }
- else if (container.getType() == IContainer.FOLDER) {
- try {
- ((IFolder) container).create(true, true, null);
- }
- catch (CoreException e) {
- throw new ExecutionException("Could not create folder", e); //$NON-NLS-1$
- }
- }
- else {
- throw new ExecutionException("Container is not a project or folder"); //$NON-NLS-1$
- }
- }
- this.container = container;
- }
-
- protected void createFile(IProgressMonitor monitor) throws ExecutionException {
- String fileName = getDataModel().getStringProperty(FILE_NAME);
- IFile newFile = this.container.getFile(new Path(fileName));
- AbstractXmlResourceProvider resourceProvider = getXmlResourceProvider(newFile);
- try {
- resourceProvider.createFileAndResource(getDataModel(), monitor);
- }
- catch (CoreException e) {
- throw new ExecutionException("Could not create file", e);
- }
- this.file = newFile;
- }
-
- @Override
- public ISchedulingRule getSchedulingRule() {
- try {
- return this.getProject();
- } catch (ExecutionException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- protected abstract AbstractXmlResourceProvider getXmlResourceProvider(IFile file);
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java
deleted file mode 100644
index e321504544..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.operations;
-
-import org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties;
-
-public interface JpaFileCreationDataModelProperties extends JptFileCreationDataModelProperties
-{
-
- /**
- * Required, type {@link String}, identifies the version of the file to create
- */
- String VERSION = "JpaFileCreationDataModelProperties.VERSION"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java
deleted file mode 100644
index 2f7bb7ebc5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.operations;
-
-public interface OrmFileCreationDataModelProperties
- extends JpaFileCreationDataModelProperties
-{
- /**
- * Optional, type AccessType, specifies the default access type (or null)
- */
- String DEFAULT_ACCESS = "OrmFileCreationDataModelProperties.DEFAULT_ACCESS"; //$NON-NLS-1$
-
- /**
- * Required, type Boolean, specifies whether to add a reference to the file
- * in the persistence unit
- */
- String ADD_TO_PERSISTENCE_UNIT = "OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT"; //$NON-NLS-1$
-
- /**
- * Optional (unless ADD_TO_PERSISTENCE_UNIT property is true), type String,
- * identifies the persistence unit to which to add a reference to the file
- */
- String PERSISTENCE_UNIT = "OrmFileCreationDataModelProperties.PERSISTENCE_UNIT"; //$NON-NLS-1$
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
deleted file mode 100644
index 56fc36696e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java
+++ /dev/null
@@ -1,278 +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.jpa.core.internal.operations;
-
-import java.util.Set;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
-import org.eclipse.jpt.jpa.core.resource.orm.AccessType;
-import org.eclipse.jpt.jpa.core.resource.orm.JPA;
-import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class OrmFileCreationDataModelProvider
- extends AbstractJpaFileCreationDataModelProvider
- implements OrmFileCreationDataModelProperties
-{
- /**
- * required default constructor
- */
- public OrmFileCreationDataModelProvider() {
- super();
- }
-
-
- @Override
- public IDataModelOperation getDefaultOperation() {
- return new OrmFileCreationOperation(getDataModel());
- }
-
- @Override
- public Set<String> getPropertyNames() {
- Set<String> propertyNames = super.getPropertyNames();
- propertyNames.add(DEFAULT_ACCESS);
- propertyNames.add(ADD_TO_PERSISTENCE_UNIT);
- propertyNames.add(PERSISTENCE_UNIT);
- return propertyNames;
- }
-
- @Override
- public boolean isPropertyEnabled(String propertyName) {
- if (propertyName.equals(PERSISTENCE_UNIT)) {
- return getBooleanProperty(ADD_TO_PERSISTENCE_UNIT);
- }
- return super.isPropertyEnabled(propertyName);
- }
-
- @Override
- public Object getDefaultProperty(String propertyName) {
- if (propertyName.equals(DEFAULT_ACCESS)) {
- return null;
- }
- else if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT)) {
- return Boolean.FALSE;
- }
- else if (propertyName.equals(PERSISTENCE_UNIT)) {
- PersistenceUnit pUnit = getDefaultPersistenceUnit();
- if (pUnit != null) {
- return pUnit.getName();
- }
- }
- return super.getDefaultProperty(propertyName);
- }
-
- @Override
- protected String getDefaultFileName() {
- return JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment();
- }
-
- @Override
- protected String getDefaultVersion() {
- if (getProject() == null) {
- return null;
- }
- JpaPlatform jpaPlatform;
- JpaProject jpaProject = getJpaProject();
- jpaPlatform = (jpaProject == null)
- ? JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject())
- : jpaProject.getJpaPlatform();
- return jpaPlatform.getMostRecentSupportedResourceType(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE).getVersion();
- }
-
- protected PersistenceUnit getDefaultPersistenceUnit() {
- JpaProject jpaProject = getJpaProject();
- if (jpaProject == null) {
- return null;
- }
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return null;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return null;
- }
- if (persistence.getPersistenceUnitsSize() == 0) {
- return null;
- }
- return persistence.getPersistenceUnits().iterator().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 TransformationIterable<String, DataModelPropertyDescriptor>(new CompositeIterable<String>(null, getPersistenceUnitNames())) {
- @Override
- protected DataModelPropertyDescriptor transform(String next) {
- return persistenceUnitPropertyDescriptor(next);
- }
- },
- new DataModelPropertyDescriptor[0]);
- }
- return super.getValidPropertyDescriptors(propertyName);
- }
-
- @Override
- public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) {
- if (propertyName.equals(DEFAULT_ACCESS)) {
- return accessPropertyDescriptor((AccessType) getProperty(DEFAULT_ACCESS));
- }
- if (propertyName.equals(PERSISTENCE_UNIT)) {
- return persistenceUnitPropertyDescriptor(getStringProperty(PERSISTENCE_UNIT));
- }
- return super.getPropertyDescriptor(propertyName);
- }
-
- protected DataModelPropertyDescriptor accessPropertyDescriptor(AccessType accessType) {
- if (accessType == null) {
- return new DataModelPropertyDescriptor(null, JptCoreMessages.NONE);
- }
- return new DataModelPropertyDescriptor(accessType, accessType.getName());
- }
-
- DataModelPropertyDescriptor persistenceUnitPropertyDescriptor(String persistenceUnitName) {
- if (StringTools.stringIsEmpty(persistenceUnitName)) {
- return new DataModelPropertyDescriptor(null, JptCoreMessages.NONE);
- }
- return new DataModelPropertyDescriptor(persistenceUnitName);
- }
-
-
- // **************** validation *********************************************
-
- @Override
- public IStatus validate(String propertyName) {
- IStatus status = super.validate(propertyName);
- if (! status.isOK()) {
- return status;
- }
-
- if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT)
- || propertyName.equals(PERSISTENCE_UNIT)) {
- status = validatePersistenceUnit();
- }
- if (! status.isOK()) {
- return status;
- }
-
- return Status.OK_STATUS;
- }
-
- @Override
- protected boolean fileVersionSupported(String fileVersion) {
- return (fileVersion.equals(JPA.SCHEMA_VERSION)
- || fileVersion.equals(JPA2_0.SCHEMA_VERSION));
- }
-
- @Override
- protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) {
- if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0.getVersionString())
- && fileVersion.equals(JPA2_0.SCHEMA_VERSION)) {
- return false;
- }
- return true;
- }
-
- protected IStatus validatePersistenceUnit() {
- boolean addToPUnit = getBooleanProperty(ADD_TO_PERSISTENCE_UNIT);
- String projectName = getProject().getName();
- String pUnitName = getStringProperty(PERSISTENCE_UNIT);
- if (addToPUnit) {
- if (StringTools.stringIsEmpty(pUnitName)) {
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED, pUnitName));
- }
- if (getPersistenceUnit() == null) {
- return new Status(
- IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID,
- NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT, pUnitName, projectName));
- }
- }
- return Status.OK_STATUS;
- }
-
-
- // **************** helper methods *****************************************
-
- protected PersistenceUnit getPersistenceUnit() {
- String pUnitName = getStringProperty(PERSISTENCE_UNIT);
- JpaProject jpaProject =
- (StringTools.stringIsEmpty(pUnitName)) ? null : getJpaProject();
- PersistenceXml persistenceXml =
- (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml();
- Persistence persistence =
- (persistenceXml == null) ? null : persistenceXml.getPersistence();
- if (persistence != null) {
- for (PersistenceUnit next : persistence.getPersistenceUnits()) {
- if (pUnitName.equals(next.getName())) {
- return next;
- }
- }
- }
- return null;
- }
-
- protected Iterable<PersistenceUnit> getPersistenceUnits() {
- //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) ? EmptyIterable.<PersistenceUnit>instance() : persistence.getPersistenceUnits();
- }
-
- protected Iterable<String> getPersistenceUnitNames() {
- return new TransformationIterable<PersistenceUnit, String>(getPersistenceUnits()) {
- @Override
- protected String transform(PersistenceUnit next) {
- return next.getName();
- }
- };
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
deleted file mode 100644
index 61eaf568fd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java
+++ /dev/null
@@ -1,106 +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.jpa.core.internal.operations;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.core.internal.resource.orm.OrmXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class OrmFileCreationOperation
- extends AbstractJpaFileCreationOperation
- implements OrmFileCreationDataModelProperties
-{
- public OrmFileCreationOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
-
- @Override
- public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- SubMonitor sm = SubMonitor.convert(monitor, 5);
- IStatus status = super.execute(sm.newChild(4), info);
-
- if (status.isOK()) {
- addMappingFileToPersistenceXml();
- sm.worked(1);
- }
-
- return OK_STATUS;
- }
-
- protected PersistenceUnit getPersistenceUnit() throws ExecutionException {
- String pUnitName = getDataModel().getStringProperty(PERSISTENCE_UNIT);
- JpaProject jpaProject = getJpaProject();
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- throw new ExecutionException("Project does not have a persistence.xml file"); //$NON-NLS-1$
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- throw new ExecutionException("persistence.xml does not have a persistence node."); //$NON-NLS-1$
- }
- for (PersistenceUnit pUnit : persistence.getPersistenceUnits()) {
- if (pUnitName.equals(pUnit.getName())) {
- return pUnit;
- }
- }
- throw new ExecutionException("persistence.xml does not have persistence unit named \'" + pUnitName + "\'"); //$NON-NLS-1$
- }
-
- protected void addMappingFileToPersistenceXml() throws ExecutionException {
- if (! getDataModel().getBooleanProperty(ADD_TO_PERSISTENCE_UNIT)) {
- return;
- }
- JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(this.file.getProject());
- JpaXmlResource resource = jpaProject.getPersistenceXmlResource();
-
- final PersistenceUnit pUnit = getPersistenceUnit();
-
- resource.modify(new Runnable() {
- public void run() {
- IPath containerPath = (IPath) getDataModel().getProperty(CONTAINER_PATH);
- String fileName = getDataModel().getStringProperty(FILE_NAME);
- IContainer container = PlatformTools.getContainer(containerPath);
- IPath filePath = container.getFullPath().append(fileName);
- IProject project = container.getProject();
- IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, filePath);
- for (MappingFileRef ref : pUnit.getSpecifiedMappingFileRefs()) {
- if (runtimePath.equals(ref.getFileName())) {
- return;
- }
- }
- pUnit.addSpecifiedMappingFileRef(runtimePath.toString());
- }
- });
- }
-
- @Override
- protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
- return OrmXmlResourceProvider.getXmlResourceProvider(file);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java
deleted file mode 100644
index 9b74e68753..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.operations;
-
-public interface PersistenceFileCreationDataModelProperties
- extends JpaFileCreationDataModelProperties
-{
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java
deleted file mode 100644
index 506f97545a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.operations;
-
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.resource.persistence.JPA;
-import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
-
-public class PersistenceFileCreationDataModelProvider
- extends AbstractJpaFileCreationDataModelProvider
- implements PersistenceFileCreationDataModelProperties
-{
- /**
- * required default constructor
- */
- public PersistenceFileCreationDataModelProvider() {
- super();
- }
-
-
- @Override
- public IDataModelOperation getDefaultOperation() {
- return new PersistenceFileCreationOperation(getDataModel());
- }
-
- @Override
- protected String getDefaultFileName() {
- return JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH.lastSegment();
- }
-
- @Override
- protected String getDefaultVersion() {
- if (getProject() == null) {
- return null;
- }
- JpaPlatform jpaPlatform;
- JpaProject jpaProject = getJpaProject();
- jpaPlatform = (jpaProject == null)
- ? JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject())
- : jpaProject.getJpaPlatform();
- return jpaPlatform.getMostRecentSupportedResourceType(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion();
- }
-
-
- // **************** validation *********************************************
-
- @Override
- protected boolean fileVersionSupported(String fileVersion) {
- return (fileVersion.equals(JPA.SCHEMA_VERSION)
- || fileVersion.equals(JPA2_0.SCHEMA_VERSION));
- }
-
- @Override
- protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) {
- if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0.getVersionString())
- && fileVersion.equals(JPA2_0.SCHEMA_VERSION)) {
- return false;
- }
- return true;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java
deleted file mode 100644
index 996b0454b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.operations;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.jpa.core.internal.resource.persistence.PersistenceXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class PersistenceFileCreationOperation
- extends AbstractJpaFileCreationOperation
- implements PersistenceFileCreationDataModelProperties
-{
- public PersistenceFileCreationOperation(IDataModel dataModel) {
- super(dataModel);
- }
-
-
- @Override
- protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) {
- return PersistenceXmlResourceProvider.getXmlResourceProvider(file);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java
deleted file mode 100644
index 9b4f62447b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java
+++ /dev/null
@@ -1,109 +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.jpa.core.internal.platform;
-
-import org.eclipse.jpt.common.core.internal.utility.XPointTools;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JpaPlatformFactory;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-public class JpaPlatformDescriptionImpl
- implements JpaPlatformDescription {
-
- private String id;
- private String pluginId;
- private String label;
- private String factoryClassName;
- private IProjectFacetVersion jpaFacetVersion;
- private boolean default_ = false;
- private JpaPlatformGroupDescriptionImpl group;
-
-
- public String getId() {
- return this.id;
- }
-
- void setId(String id) {
- this.id = id;
- }
-
- public String getPluginId() {
- return this.pluginId;
- }
-
- void setPluginId(String pluginId) {
- this.pluginId = pluginId;
- }
-
- public String getLabel() {
- return this.label;
- }
-
- void setLabel(String label) {
- this.label = label;
- }
-
- public String getFactoryClassName() {
- return this.factoryClassName;
- }
-
- void setFactoryClassName(String className) {
- this.factoryClassName = className;
- }
-
- public IProjectFacetVersion getJpaFacetVersion() {
- return this.jpaFacetVersion;
- }
-
- void setJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
- if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) {
- throw new IllegalArgumentException(jpaFacetVersion.toString());
- }
- this.jpaFacetVersion = jpaFacetVersion;
- }
-
- public boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) {
- if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) {
- throw new IllegalArgumentException(jpaFacetVersion.toString());
- }
- return (this.jpaFacetVersion != null) ? this.jpaFacetVersion.equals(jpaFacetVersion) : true;
- }
-
- public boolean isDefault() {
- return this.default_;
- }
-
- void setDefault(boolean default_) {
- this.default_ = default_;
- }
-
- public JpaPlatformGroupDescription getGroup() {
- return this.group;
- }
-
- void setGroup(JpaPlatformGroupDescriptionImpl group) {
- this.group = group;
- }
-
- public JpaPlatform buildJpaPlatform() {
- JpaPlatformFactory factory = (JpaPlatformFactory) XPointTools.instantiate(
- this.pluginId, JpaPlatformManagerImpl.QUALIFIED_EXTENSION_POINT_ID,
- this.factoryClassName, JpaPlatformFactory.class);
- return factory.buildJpaPlatform(getId());
- }
-
- @Override
- public String toString() {
- return this.label;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java
deleted file mode 100644
index 2ca9afe58c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.platform;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
-
-public class JpaPlatformGroupDescriptionImpl
- implements JpaPlatformGroupDescription {
-
- private String id;
- private String pluginId;
- private String label;
- private Map<String, JpaPlatformDescriptionImpl> platforms;
-
-
- JpaPlatformGroupDescriptionImpl() {
- this.platforms = new HashMap<String, JpaPlatformDescriptionImpl>();
- }
-
- public String getId() {
- return this.id;
- }
-
- void setId(String id) {
- this.id = id;
- }
-
- public String getPluginId() {
- return this.pluginId;
- }
-
- void setPluginId(String pluginId) {
- this.pluginId = pluginId;
- }
-
- public String getLabel() {
- return this.label;
- }
-
- void setLabel(String label) {
- this.label = label;
- }
-
- void addPlatform(JpaPlatformDescriptionImpl platform) {
- this.platforms.put(platform.getId(), platform);
- }
-
- public Iterable<JpaPlatformDescription> getPlatforms() {
- return new SuperIterableWrapper<JpaPlatformDescription>(CollectionTools.collection(this.platforms.values()));
- }
-
- @Override
- public String toString() {
- return this.label;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java
deleted file mode 100644
index 409d8bba48..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java
+++ /dev/null
@@ -1,238 +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.jpa.core.internal.platform;
-
-import static org.eclipse.jpt.common.core.internal.utility.XPointTools.*;
-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.utility.XPointTools.XPointException;
-import org.eclipse.jpt.common.utility.internal.KeyedSet;
-import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper;
-import org.eclipse.jpt.jpa.core.JpaFacet;
-import org.eclipse.jpt.jpa.core.JpaPlatform;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription;
-import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
-
-/**
- * Singleton registry for storing all the registered JPA platform configuration
- * elements and instantiating JPA platforms from them.
- */
-public class JpaPlatformManagerImpl
- implements JpaPlatformManager {
-
- static final String EXTENSION_POINT_ID = "jpaPlatforms"; //$NON-NLS-1$
- static final String QUALIFIED_EXTENSION_POINT_ID = JptJpaCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID;
- static final String PLATFORM_GROUP_ELEMENT = "jpaPlatformGroup"; //$NON-NLS-1$
- static final String PLATFORM_ELEMENT = "jpaPlatform"; //$NON-NLS-1$
- static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
- static final String LABEL_ATTRIBUTE = "label"; //$NON-NLS-1$
- static final String FACTORY_CLASS_ATTRIBUTE = "factoryClass"; //$NON-NLS-1$
- static final String JPA_FACET_VERSION_ATTRIBUTE = "jpaFacetVersion"; //$NON-NLS-1$
- static final String DEFAULT_ATTRIBUTE = "default"; //$NON-NLS-1$
- static final String GROUP_ELEMENT = "group"; //$NON-NLS-1$
-
-
- private static final JpaPlatformManagerImpl INSTANCE = new JpaPlatformManagerImpl();
-
-
- public static JpaPlatformManagerImpl instance() {
- return INSTANCE;
- }
-
-
- private KeyedSet<String, JpaPlatformGroupDescriptionImpl> jpaPlatformGroupDescriptions;
- private KeyedSet<String, JpaPlatformDescriptionImpl> jpaPlatformDescriptions;
-
-
- // ********** constructor/initialization **********
-
- private JpaPlatformManagerImpl() {
- super();
- this.jpaPlatformGroupDescriptions = new KeyedSet<String, JpaPlatformGroupDescriptionImpl>();
- this.jpaPlatformDescriptions = new KeyedSet<String, JpaPlatformDescriptionImpl>();
- readExtensions();
- }
-
-
- private void readExtensions() {
- final IExtensionRegistry registry = Platform.getExtensionRegistry();
-
- final IExtensionPoint xpoint
- = registry.getExtensionPoint(JptJpaCorePlugin.PLUGIN_ID, EXTENSION_POINT_ID);
-
- if (xpoint == null) {
- throw new IllegalStateException();
- }
-
- List<IConfigurationElement> platformGroupConfigs = new ArrayList<IConfigurationElement>();
- List<IConfigurationElement> platformConfigs = new ArrayList<IConfigurationElement>();
-
- for (IExtension extension : xpoint.getExtensions()) {
- for (IConfigurationElement element : extension.getConfigurationElements()) {
- if (element.getName().equals(PLATFORM_GROUP_ELEMENT)) {
- platformGroupConfigs.add(element);
- }
- else if (element.getName().equals(PLATFORM_ELEMENT)) {
- platformConfigs.add(element);
- }
- }
- }
-
- for (IConfigurationElement element : platformGroupConfigs) {
- readPlatformGroupExtension(element);
- }
-
- for (IConfigurationElement element : platformConfigs) {
- readPlatformExtension(element);
- }
- }
-
- private void readPlatformGroupExtension(IConfigurationElement element) {
- try {
- final JpaPlatformGroupDescriptionImpl desc = new JpaPlatformGroupDescriptionImpl();
-
- // plug-in id
- desc.setPluginId(element.getContributor().getName());
-
- // id
- desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
-
- if (this.jpaPlatformGroupDescriptions.containsKey(desc.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId());
- throw new XPointException();
- }
-
- // label
- desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE));
-
- this.jpaPlatformGroupDescriptions.addItem(desc.getId(), desc);
- }
- catch (XPointException e) {
- // Ignore and continue. The problem has already been reported to the user
- // in the log.
- }
- }
-
- private void readPlatformExtension(IConfigurationElement element) {
- try {
- final JpaPlatformDescriptionImpl desc = new JpaPlatformDescriptionImpl();
-
- // plug-in id
- desc.setPluginId(element.getContributor().getName());
-
- // id
- desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE));
-
- if (this.jpaPlatformDescriptions.containsKey(desc.getId())) {
- logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId());
- throw new XPointException();
- }
-
- // label
- desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE));
-
- // factory class
- desc.setFactoryClassName(findRequiredAttribute(element, FACTORY_CLASS_ATTRIBUTE));
-
- // JPA facet version
- String jpaFacetVersionString = element.getAttribute(JPA_FACET_VERSION_ATTRIBUTE);
- if (jpaFacetVersionString != null) {
- IProjectFacetVersion jpaFacetVersion = JpaFacet.FACET.getVersion(jpaFacetVersionString);
- if (jpaFacetVersion != null) {
- desc.setJpaFacetVersion(jpaFacetVersion);
- }
- else {
- logInvalidValue(element, JPA_FACET_VERSION_ATTRIBUTE, jpaFacetVersionString);
- throw new XPointException();
- }
- }
-
- // default
- String defaultString = element.getAttribute(DEFAULT_ATTRIBUTE);
- if (defaultString != null) {
- if (defaultString.equals("true")) {
- desc.setDefault(true);
- }
- else if (defaultString.equals("false")) {
- desc.setDefault(false);
- }
- else {
- logInvalidValue(element, DEFAULT_ATTRIBUTE, defaultString);
- throw new XPointException();
- }
- }
-
- // group
- String groupId = element.getAttribute(GROUP_ELEMENT);
- if (groupId != null) {
- JpaPlatformGroupDescriptionImpl group = this.jpaPlatformGroupDescriptions.getItem(groupId);
- if (group != null) {
- desc.setGroup(group);
- group.addPlatform(desc);
- }
- else {
- logInvalidValue(element, GROUP_ELEMENT, groupId);
- throw new XPointException();
- }
- }
-
- this.jpaPlatformDescriptions.addItem(desc.getId(), desc);
- }
- catch (XPointException e) {
- // Ignore and continue. The problem has already been reported to the user
- // in the log.
- }
- }
-
-
- // ********** public methods **********
-
- public Iterable<JpaPlatformGroupDescription> getJpaPlatformGroups() {
- return new SuperIterableWrapper<JpaPlatformGroupDescription>(this.jpaPlatformGroupDescriptions.getItemSet());
- }
-
- public JpaPlatformGroupDescription getJpaPlatformGroup(String groupId) {
- return this.jpaPlatformGroupDescriptions.getItem(groupId);
- }
-
- public Iterable<JpaPlatformDescription> getJpaPlatforms() {
- return new SuperIterableWrapper<JpaPlatformDescription>(this.jpaPlatformDescriptions.getItemSet());
- }
-
- public JpaPlatformDescription getJpaPlatform(String platformId) {
- return this.jpaPlatformDescriptions.getItem(platformId);
- }
-
- public JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion) {
- for (JpaPlatformDescription platform : getJpaPlatforms()) {
- if (platform.isDefault() && platform.supportsJpaFacetVersion(jpaFacetVersion)) {
- return platform;
- }
- }
- return null;
- }
- public JpaPlatform buildJpaPlatformImplementation(IProject project) {
- String jpaPlatformId = JptJpaCorePlugin.getJpaPlatformId(project);
- JpaPlatformDescriptionImpl platformDesc = this.jpaPlatformDescriptions.getItem(jpaPlatformId);
- if (platformDesc == null) {
- throw new IllegalArgumentException("Project does not have a recognized JPA platform.");
- }
- return platformDesc.buildJpaPlatform();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java
deleted file mode 100644
index d6fd0418ca..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.prefs;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-
-/**
- * Class used to initialize default preference values.
- * See <code>org.eclipse.core.runtime.preferences</code> extension point.
- */
-public class JpaPreferenceInitializer
- extends AbstractPreferenceInitializer
-{
- @Override
- public void initializeDefaultPreferences() {
- JptJpaCorePlugin.initializeDefaultPreferences();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
deleted file mode 100644
index 9d948a34c3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java
+++ /dev/null
@@ -1,288 +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.jpa.core.internal.refactoring;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.DeleteParticipant;
-import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.TextEdit;
-
-
-public abstract class AbstractJpaDeleteTypeParticipant
- extends DeleteParticipant
-{
-
- /**
- * Store all the types that are going to be deleted including nestedTypes.
- */
- protected final Set<IType> allTypes;
-
- /**
- * Store the persistence.xml DeleteEdits in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<DeleteEdit>> persistenceXmlDeleteEdits;
-
- /**
- * Store the mapping file DeleteEdits in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<DeleteEdit>> mappingFilePersistentTypeDeleteEdits;
-
- protected AbstractJpaDeleteTypeParticipant() {
- super();
- this.allTypes = new HashSet<IType>();
- this.persistenceXmlDeleteEdits = new HashMap<IFile, Iterable<DeleteEdit>>();
- this.mappingFilePersistentTypeDeleteEdits = new HashMap<IFile, Iterable<DeleteEdit>>();
- }
-
- /**
- * Nested types are not added to the deleteParticipant when the parent is deleted.
- * We must handle them in case they are mapped.
- */
- protected void addType(IType type) {
- this.allTypes.add(type);
- this.addNestedTypes(type);
- }
-
- private void addNestedTypes(IType type) {
- IType[] nestedTypes;
- try {
- nestedTypes = type.getTypes();
- }
- catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return;
- }
-
- for (IType nestedType : nestedTypes) {
- this.addType(nestedType);
- }
- }
-
- //**************** RefactoringParticipant implementation *****************
-
- /**
- * Inform the refactoring processor of any files that are going to change. In the process of determining
- * this go ahead and build up the appropriate DeleteEdits to be used in the createChange()
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
- //since the progress bar will hang if a large JPA project is being loaded,
- //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
- monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
- JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
- if (jpaProjectManager.getJpaProjectsSize() == 0) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2);
- sm.subTask(this.getCheckConditionsSubTaskName());
- ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
- IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
-
- for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) {
- this.createDeleteEdits(sm.newChild(10), jpaProject);
- }
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- for (IFile file : this.persistenceXmlDeleteEdits.keySet()) {
- deltaFactory.change(file);
- }
- sm.worked(1);
- for (IFile file : this.mappingFilePersistentTypeDeleteEdits.keySet()) {
- deltaFactory.change(file);
- }
- sm.worked(1);
-
- return null;
- }
-
- /**
- * This will be appended to the main refactoring task named : 'Checking preconditions...'
- */
- protected String getCheckConditionsSubTaskName() {
- return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME;
- }
-
- @Override
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (this.persistenceXmlDeleteEdits.isEmpty() && this.mappingFilePersistentTypeDeleteEdits.isEmpty()) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlDeleteEdits.size() + this.mappingFilePersistentTypeDeleteEdits.size());
- sm.subTask(this.getCreateChangeSubTaskName());
- CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_CHANGE_NAME);
- for (IFile persistenceXmlFile : this.persistenceXmlDeleteEdits.keySet()) {
- this.addPersistenceXmlDeleteTypeChange(persistenceXmlFile, compositeChange);
- sm.worked(1);
- }
- for (IFile mappingFile : this.mappingFilePersistentTypeDeleteEdits.keySet()) {
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- this.addMappingFileDeleteTypeChange(mappingFile, compositeChange);
- sm.worked(1);
- }
- //must check for children in case all changes were made in other participant's TextChanges,
- //want to return null so our node does not appear in the preview tree
- return compositeChange.getChildren().length == 0 ? null : compositeChange;
- }
-
- /**
- * This will be appended to the main refactoring task named : 'Creating workspace modifications...'
- */
- protected String getCreateChangeSubTaskName() {
- return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME;
- }
-
- protected void createDeleteEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException {
- PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
- if (persistenceUnit == null) {
- return;
- }
- SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.getMappingFileRefsSize());
- Iterable<DeleteEdit> persistenceXmlDeleteEdits = this.createPersistenceXmlDeleteEdits(persistenceUnit);
- if (!CollectionTools.isEmpty(persistenceXmlDeleteEdits)) {
- this.persistenceXmlDeleteEdits.put(jpaProject.getPersistenceXmlResource().getFile(), persistenceXmlDeleteEdits);
- }
- sm.worked(1);
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFileRefs()) {
- 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.getPersistenceUnitsSize() != 1) {
- return null; // the context model currently only supports 1 persistence unit
- }
- return persistence.getPersistenceUnits().iterator().next();
- }
-
- private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
- for (TextEdit textEdit : textEdits) {
- try {
- textChange.addEdit(textEdit);
- }
- catch (MalformedTreeException ex) {
- //log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(ex);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
deleted file mode 100644
index 9024e3eed8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java
+++ /dev/null
@@ -1,294 +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.jpa.core.internal.refactoring;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
-import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
-import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
-import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
-public abstract class AbstractJpaMoveJavaElementParticipant
- extends MoveParticipant implements ISharableParticipant {
-
- /**
- * Store the {@link IJavaElements}s to be moved and their corresponding {@link MoveArguments}
- */
- protected final Map<IJavaElement, MoveArguments> originalJavaElements;
-
- /**
- * Store the persistence.xml ReplaceEdits in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlReplaceEdits;
-
- /**
- * Store the mapping file ReplaceEdits in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<ReplaceEdit>> mappingFileReplaceEdits;
-
- protected AbstractJpaMoveJavaElementParticipant() {
- super();
- this.originalJavaElements = new HashMap<IJavaElement, MoveArguments>();
- this.persistenceXmlReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
- this.mappingFileReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
- }
-
- @Override
- protected boolean initialize(Object element) {
- if (!getArguments().getUpdateReferences()) {
- //we do not want to do any refactoring if the user chooses not to update references
- return false;
- }
- this.addElement(element, getArguments());
- return true;
- }
-
-
- //****************ISharableParticipant implementation *****************
- /**
- * This is used when multiple mapping files are deleted.
- * RefactoringParticipant#initialize(Object) is called for the first deleted IFile.
- * RefactoringParticipant#getArguments() only applies to the first deleted IFile
- */
- public void addElement(Object element, RefactoringArguments arguments) {
- this.originalJavaElements.put((IJavaElement) element, (MoveArguments) arguments);
- }
-
- protected MoveArguments getArguments(IJavaElement element) {
- return this.originalJavaElements.get(element);
- }
-
- //**************** RefactoringParticipant implementation *****************
-
- /**
- * Inform the refactoring processor of any files that are going to change. In the process of determining
- * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
- monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
- JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
- if (jpaProjectManager.getJpaProjectsSize() == 0) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2);
- sm.subTask(this.getCheckConditionsSubTaskName());
- ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
- IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
-
- for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) {
- this.createReplaceEdits(sm.newChild(10), jpaProject);
- }
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- for (IFile file : this.persistenceXmlReplaceEdits.keySet()) {
- deltaFactory.change(file);
- }
- sm.worked(1);
- for (IFile file : this.mappingFileReplaceEdits.keySet()) {
- deltaFactory.change(file);
- }
- sm.worked(1);
-
- return null;
- }
-
- protected abstract String getCompositeChangeName();
-
- /**
- * This will be appended to the main refactoring task named : 'Checking preconditions...'
- */
- protected abstract String getCheckConditionsSubTaskName();
-
- @Override
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (this.persistenceXmlReplaceEdits.isEmpty() && this.mappingFileReplaceEdits.isEmpty()) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size() + this.mappingFileReplaceEdits.size());
- sm.subTask(this.getCreateChangeSubTaskName());
- CompositeChange compositeChange = new CompositeChange(this.getCompositeChangeName());
- for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
- this.addPersistenceXmlRenameEdits(persistenceXmlFile, compositeChange);
- sm.worked(1);
- }
- for (IFile mappingFile : this.mappingFileReplaceEdits.keySet()) {
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- this.addMappingFileRenameEdits(mappingFile, compositeChange);
- sm.worked(1);
- }
- //must check for children in case all changes were made in other participant's TextChanges,
- //want to return null so our node does not appear in the preview tree
- return compositeChange.getChildren().length == 0 ? null : compositeChange;
- }
-
- /**
- * This will be appended to the main refactoring task named : 'Creating workspace modifications...'
- */
- protected abstract String getCreateChangeSubTaskName();
-
- protected void createReplaceEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException {
- PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
- if (persistenceUnit == null) {
- return;
- }
- SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.getMappingFileRefsSize());
- Iterable<ReplaceEdit> classRefDeleteEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit);
- sm.worked(1);
- if (!CollectionTools.isEmpty(classRefDeleteEdits)) {
- this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits);
- }
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFileRefs()) {
- 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.getPersistenceUnitsSize() != 1) {
- return null; // the context model currently only supports 1 persistence unit
- }
- return persistence.getPersistenceUnits().iterator().next();
- }
-
- private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
- for (TextEdit textEdit : textEdits) {
- try {
- textChange.addEdit(textEdit);
- }
- catch (MalformedTreeException ex) {
- //log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(ex);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
deleted file mode 100644
index 123153e758..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java
+++ /dev/null
@@ -1,257 +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.jpa.core.internal.refactoring;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
-import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
-public abstract class AbstractJpaRenameJavaElementParticipant
- extends RenameParticipant {
-
- protected IJavaElement originalJavaElement;
-
- /**
- * Store the persistence.xml ReplaceEdits in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlReplaceEdits;
-
- /**
- * Store the mapping file ReplaceEdits in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<ReplaceEdit>> mappingFileReplaceEdits;
-
- protected AbstractJpaRenameJavaElementParticipant() {
- super();
- this.persistenceXmlReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
- this.mappingFileReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
- }
-
- @Override
- protected boolean initialize(Object element) {
- if (!getArguments().getUpdateReferences()) {
- //we do not want to do any refactoring if the user chooses not to update references
- return false;
- }
- this.originalJavaElement = (IJavaElement) element;
- return true;
- }
-
- protected IJavaElement getOriginalJavaElement() {
- return this.originalJavaElement;
- }
-
-
- //**************** RefactoringParticipant implementation *****************
-
- /**
- * Inform the refactoring processor of any files that are going to change. In the process of determining
- * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
- monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
- JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
- if (jpaProjectManager.getJpaProjectsSize() == 0) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2);
- sm.subTask(this.getCheckConditionsSubTaskName());
- ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
- IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
-
- for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) {
- this.createReplaceEdits(sm.newChild(10), jpaProject);
- }
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- for (IFile file : this.persistenceXmlReplaceEdits.keySet()) {
- deltaFactory.change(file);
- }
- sm.worked(1);
- for (IFile file : this.mappingFileReplaceEdits.keySet()) {
- deltaFactory.change(file);
- }
- sm.worked(1);
-
- return null;
- }
-
- protected abstract String getCompositeChangeName();
-
- /**
- * This will be appended to the main refactoring task named : 'Checking preconditions...'
- */
- protected abstract String getCheckConditionsSubTaskName();
-
- @Override
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (this.persistenceXmlReplaceEdits.isEmpty() && this.mappingFileReplaceEdits.isEmpty()) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size() + this.mappingFileReplaceEdits.size());
- sm.subTask(this.getCreateChangeSubTaskName());
- CompositeChange compositeChange = new CompositeChange(this.getCompositeChangeName());
- for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
- this.addPersistenceXmlRenameEdits(persistenceXmlFile, compositeChange);
- sm.worked(1);
- }
- for (IFile mappingFile : this.mappingFileReplaceEdits.keySet()) {
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- this.addMappingFileRenameEdits(mappingFile, compositeChange);
- sm.worked(1);
- }
- //must check for children in case all changes were made in other participant's TextChanges,
- //want to return null so our node does not appear in the preview tree
- return compositeChange.getChildren().length == 0 ? null : compositeChange;
- }
-
- /**
- * This will be appended to the main refactoring task named : 'Creating workspace modifications...'
- */
- protected abstract String getCreateChangeSubTaskName();
-
- protected void createReplaceEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException {
- PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
- if (persistenceUnit == null) {
- return;
- }
- SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.getMappingFileRefsSize());
- Iterable<ReplaceEdit> classRefDeleteEdits = this.createPersistenceXmlReplaceEditsCheckClasspath(persistenceUnit);
- sm.worked(1);
- if (!CollectionTools.isEmpty(classRefDeleteEdits)) {
- this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits);
- }
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFileRefs()) {
- 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.getPersistenceUnitsSize() != 1) {
- return null; // the context model currently only supports 1 persistence unit
- }
- return persistence.getPersistenceUnits().iterator().next();
- }
-
- private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
- for (TextEdit textEdit : textEdits) {
- try {
- textChange.addEdit(textEdit);
- }
- catch (MalformedTreeException ex) {
- //log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(ex);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java
deleted file mode 100644
index 5ff1a8444b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.refactoring;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Localized messages used by Dali core.
- */
-public class JpaCoreRefactoringMessages {
-
- public static String JPA_DELETE_TYPE_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_DELETE_PACKAGE_OR_FOLDER_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_NAME;
- public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
- public static String JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME;
-
- public static String JPA_DELETE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME;
- public static String JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_NAME;
- public static String JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
-
- public static String JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME;
-
- public static String JPA_RENAME_TYPE_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_NAME;
- public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
- public static String JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME;
-
- public static String JPA_RENAME_PACKAGE_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_NAME;
- public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
- public static String JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME;
-
- public static String JPA_RENAME_FOLDER_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_RENAME_FOLDER_REFACTORING_CHANGE_NAME;
- public static String JPA_RENAME_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- public static String JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME;
-
- public static String JPA_RENAME_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME;
- public static String JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_NAME;
- public static String JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
-
- public static String JPA_MOVE_TYPE_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_NAME;
- public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
- public static String JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME;
-
- public static String JPA_MOVE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME;
- public static String JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_NAME;
- public static String JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
-
- public static String JPA_MOVE_FOLDER_REFACTORING_PARTICIPANT_NAME;
- public static String JPA_MOVE_FOLDER_REFACTORING_CHANGE_NAME;
- public static String JPA_MOVE_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- public static String JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME;
-
- private static final String BUNDLE_NAME = "jpa_core_refactoring"; //$NON-NLS-1$
- private static final Class<?> BUNDLE_CLASS = JpaCoreRefactoringMessages.class;
- static {
- NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
- }
-
- private JpaCoreRefactoringMessages() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
deleted file mode 100644
index 31fd726b99..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java
+++ /dev/null
@@ -1,210 +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.jpa.core.internal.refactoring;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.DeleteArguments;
-import org.eclipse.ltk.core.refactoring.participants.DeleteParticipant;
-import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
-import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.text.edits.DeleteEdit;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * Participant in the delete refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
- * If the deleted mapping file is listed in a persistence.xml file of any JpaProject
- * then a Change object is created that will delete that reference from the file.
- */
-public class JpaDeleteMappingFileParticipant
- extends DeleteParticipant
- implements ISharableParticipant
-{
-
- /**
- * Store the {@link IFile}s to be deleted with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
- * and their corresponding {@link DeleteArguments}
- */
- protected final Map<IFile, DeleteArguments> mappingFiles;
-
- /**
- * Store the persistence.xml DeleteEdits in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<DeleteEdit>> persistenceXmlMappingFileDeleteEdits;
-
- public JpaDeleteMappingFileParticipant() {
- super();
- this.mappingFiles = new HashMap<IFile, DeleteArguments>();
- this.persistenceXmlMappingFileDeleteEdits = new HashMap<IFile, Iterable<DeleteEdit>>();
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
- }
-
- @Override
- protected boolean initialize(Object element) {
- this.addElement(element, getArguments());
- return true;
- }
-
-
- //****************ISharableParticipant implementation *****************
- /**
- * This is used when multiple mapping files are deleted.
- * RefactoringParticipant#initialize(Object) is called for the first deleted IFile.
- * RefactoringParticipant#getArguments() only applies to the first deleted IFile
- */
- public void addElement(Object element, RefactoringArguments arguments) {
- this.mappingFiles.put((IFile) element, (DeleteArguments) arguments);
- }
-
-
- //**************** RefactoringParticipant implementation *****************
-
- /**
- * Inform the refactoring processor of any files that are going to change. In the process of determining
- * this go ahead and build up the appropriate DeleteEdits to be used in the createChange()
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
- //since the progress bar will hang if a large JPA project is being loaded,
- //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
- monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
- JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
- if (jpaProjectManager.getJpaProjectsSize() == 0) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
- sm.subTask(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
- ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
- IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
-
- for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
- this.createDeleteEdits(jpaProject);
- sm.worked(10);
- }
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- for (IFile persistenceXmlFile : this.persistenceXmlMappingFileDeleteEdits.keySet()) {
- deltaFactory.change(persistenceXmlFile);
- }
- sm.worked(1);
-
- return null;
- }
-
- protected void createDeleteEdits(JpaProject jpaProject) throws OperationCanceledException {
- PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
- if (persistenceUnit == null) {
- return;
- }
- Iterable<DeleteEdit> classRefDeleteEdits = this.createSpecifiedMappingFileRefDeleteEdits(persistenceUnit);
- if (!CollectionTools.isEmpty(classRefDeleteEdits)) {
- this.persistenceXmlMappingFileDeleteEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits);
- }
- }
-
- @Override
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (this.persistenceXmlMappingFileDeleteEdits.isEmpty()) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileDeleteEdits.size());
- sm.subTask(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
- CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_NAME);
- for (IFile persistenceXmlFile : this.persistenceXmlMappingFileDeleteEdits.keySet()) {
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- this.addPersistenceXmlDeleteMappingFileChange(persistenceXmlFile, compositeChange);
- }
- //must check for children in case all changes were made in other participants TextChanges,
- //want to return null so our node does not appear in the preview tree
- return compositeChange.getChildren().length == 0 ? null : compositeChange;
- }
-
- private Iterable<DeleteEdit> createSpecifiedMappingFileRefDeleteEdits(final PersistenceUnit persistenceUnit) {
- return new CompositeIterable<DeleteEdit>(
- new TransformationIterable<IFile, Iterable<DeleteEdit>>(this.mappingFiles.keySet()) {
- @Override
- protected Iterable<DeleteEdit> transform(IFile file) {
- return persistenceUnit.createDeleteMappingFileEdits(file);
- }
- }
- );
- }
-
- protected void addPersistenceXmlDeleteMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
- TextChange textChange = getTextChange(persistenceXmlFile);
- if (textChange == null) {
- textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
- MultiTextEdit multiTextEdit = new MultiTextEdit();
- textChange.setEdit(multiTextEdit);
- compositeChange.add(textChange);
- }
- Iterable<DeleteEdit> mappingFileDeleteEdits = this.persistenceXmlMappingFileDeleteEdits.get(persistenceXmlFile);
- this.addEdits(textChange, mappingFileDeleteEdits);
- }
-
- private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return null;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return null;
- }
- if (persistence.getPersistenceUnitsSize() != 1) {
- return null; // the context model currently only supports 1 persistence unit
- }
- return persistence.getPersistenceUnits().iterator().next();
- }
-
- private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
- for (TextEdit textEdit : textEdits) {
- try {
- textChange.addEdit(textEdit);
- }
- catch (MalformedTreeException e) {
- //log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
deleted file mode 100644
index 5e67cec115..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java
+++ /dev/null
@@ -1,254 +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.jpa.core.internal.refactoring;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceProxy;
-import org.eclipse.core.resources.IResourceProxyVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.core.internal.utility.JDTTools;
-import org.eclipse.jpt.common.core.internal.utility.PlatformTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
-import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
-import org.eclipse.text.edits.DeleteEdit;
-
-public class JpaDeletePackageOrFolderParticipant
- extends AbstractJpaDeleteTypeParticipant
- implements ISharableParticipant
-{
-
- /**
- * The folders that are going to be deleted.
- * Only folders which are not also IPackageFragments or IPackageFragmentRoots are added to this collection.
- */
- protected final Collection<IFolder> folders;
-
- /**
- * The IPackageFragments that are going to be deleted.
- */
- protected final Collection<IPackageFragment> packageFragments;
-
- public JpaDeletePackageOrFolderParticipant() {
- super();
- this.folders = new ArrayList<IFolder>();
- this.packageFragments = new ArrayList<IPackageFragment>();
- }
-
- //**************** RefactoringParticipant implementation *****************
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_DELETE_PACKAGE_OR_FOLDER_REFACTORING_PARTICIPANT_NAME;
- }
-
- @Override
- protected boolean initialize(Object element) {
- if (getProcessor() instanceof RenameProcessor) {
- //Renaming a package that then ends up with no subpackages or types will call the delete folder participant.
- //We do not want to delete references in the persistence.xml and mapping files in this case, will be handled
- //with the rename participant
- return false;
- }
- this.addElement(element, getArguments());
- return true;
- }
-
- //**************** ISharableParticipant implementation *****************
- /**
- * This is used when multiple IPackageFraments/IFolders are deleted.
- * RefactoringParticipant#initialize(Object) is called for the first deleted IPackageFragment/IFolder.
- * RefactoringParticipant#getArguments() only applies to the first deleted IPackageFragment/IFolder
- */
- public void addElement(Object element, RefactoringArguments arguments) {
- if (element instanceof IFolder) {
- IJavaElement javaElement = JavaCore.create((IFolder) element);
- if (javaElement != null) {
- if (javaElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT) {
- this.addPackageFragmentRoot((IPackageFragmentRoot) javaElement);
- }
- else {
- this.addPackageFragment((IPackageFragment) javaElement);
- }
- }
- else {
- this.addFolder((IFolder) element);
- }
- }
- else {
- this.addPackageFragment((IPackageFragment) element);
- }
- }
-
- protected void addFolder(IFolder folder) {
- this.folders.add(folder);
- }
-
- protected void addPackageFragmentRoot(IPackageFragmentRoot root) {
- if (JDTTools.packageFragmentRootIsSourceFolder(root)) {
- for (IJavaElement child : JDTTools.getChildren(root)) {
- this.addPackageFragment((IPackageFragment) child);
- }
- }
- }
-
- protected void addPackageFragment(IPackageFragment packageFragment) {
- this.packageFragments.add(packageFragment);
- Collection<IType> allDeletedTypes = new HashSet<IType>();
- addAffectedTypes(allDeletedTypes, packageFragment);
- for (IType deletedType : allDeletedTypes) {
- this.addType(deletedType);
- }
- }
-
- //nestedTypes are handled in AbstractJpaDeleteTypeParticipant
- static void addAffectedTypes(Collection<IType> types, IPackageFragment fragment) {
- try {
- if (fragment.containsJavaResources()) {
- ICompilationUnit[] cunits = fragment.getCompilationUnits();
- IType type = null;
- for (int i = 0; i < cunits.length; i++) {
- type = cunits[i].findPrimaryType();
- if (type == null) {
- continue;
- }
- types.add(type);
- }
- }
- }
- catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- }
- }
-
- /**
- * Add mapping file delete edits here, super.createPersistenceXmlDeleteEdits() is
- * called to add the type delete edits.
- */
- @Override
- @SuppressWarnings("unchecked")
- protected Iterable<DeleteEdit> createPersistenceXmlDeleteEdits(final PersistenceUnit persistenceUnit) {
- return new CompositeIterable<DeleteEdit>(
- super.createPersistenceXmlDeleteEdits(persistenceUnit),
- new CompositeIterable<DeleteEdit>(
- new TransformationIterable<IFile, Iterable<DeleteEdit>>(this.getMappingFilesOnClasspath(persistenceUnit.getJpaProject())) {
- @Override
- protected Iterable<DeleteEdit> transform(IFile file) {
- return persistenceUnit.createDeleteMappingFileEdits(file);
- }
- }
- )
- );
- }
-
- @SuppressWarnings("unchecked")
- protected Iterable<IFile> getMappingFilesOnClasspath(final JpaProject jpaProject) {
- final IJavaProject javaProject = jpaProject.getJavaProject();
- return new FilteringIterable<IFile>(new CompositeIterable<IFile>(
- getPossibleMappingFilesInFolders(),
- getPossibleMappingFilesInPackageFragments()))
- {
- @Override
- protected boolean accept(IFile file) {
- return javaProject.isOnClasspath(file)
- && PlatformTools.getContentType(file).isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE);
- }
- };
- }
-
- protected Iterable<IFile> getPossibleMappingFilesInFolders() {
- Collection<IFile> files = new ArrayList<IFile>();
- FolderResourceProxyVisitor visitor = new FolderResourceProxyVisitor(files);
- for (IFolder folder : this.folders) {
- visitor.visitFolder(folder);
- }
- return files;
- }
-
- protected Iterable<IFile> getPossibleMappingFilesInPackageFragments() {
- return new CompositeIterable<IFile>(
- new TransformationIterable<IPackageFragment, Iterable<IFile>>(this.packageFragments) {
- @Override
- protected Iterable<IFile> transform(IPackageFragment packageFragment) {
- return getNonJavaFiles(packageFragment);
- }
- }
- );
- }
-
- protected static Iterable<IFile> getNonJavaFiles(IPackageFragment packageFragment) {
- Collection<IFile> files = new ArrayList<IFile>();
- Object[] resources = getNonJavaResources(packageFragment);
- for (Object resource : resources) {
- if (resource instanceof IFile) {
- files.add((IFile) resource);
- }
- }
- return files;
- }
-
- protected static Object[] getNonJavaResources(IPackageFragment packageFragment) {
- try {
- return packageFragment.getNonJavaResources();
- }
- catch (JavaModelException e) {
- JptJpaCorePlugin.log(e);
- return EMPTY_OBJECT_ARRAY;
- }
- }
-
- private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0];
-
- protected class FolderResourceProxyVisitor implements IResourceProxyVisitor {
- private Collection<IFile> files;
- protected FolderResourceProxyVisitor(Collection<IFile> files) {
- super();
- this.files = files;
- }
- protected void visitFolder(IFolder folder) {
- try {
- folder.accept(this, IResource.NONE);
- } catch (CoreException ex) {
- // shouldn't happen - we don't throw any CoreExceptions
- throw new RuntimeException(ex);
- }
- }
- public boolean visit(IResourceProxy resource) {
- switch (resource.getType()) {
- case IResource.FOLDER :
- return true; // visit children
- case IResource.FILE :
- this.files.add((IFile) resource.requestResource());
- return false; // no children
- default :
- return false; // no children
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java
deleted file mode 100644
index 7801496e65..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.refactoring;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
-
-public class JpaDeleteTypeParticipant
- extends AbstractJpaDeleteTypeParticipant
- implements ISharableParticipant
-{
-
- public JpaDeleteTypeParticipant() {
- super();
- }
-
- @Override
- protected boolean initialize(Object element) {
- this.addElement(element, getArguments());
- return true;
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_PARTICIPANT_NAME;
- }
-
-
- //****************ISharableParticipant implementation *****************
-
- /**
- * This is used when multiple ITypes are deleted.
- * RefactoringParticipant#initialize(Object) is called for the first deleted IType.
- * RefactoringParticipant#getArguments() only applies to the first deleted IType
- */
- public void addElement(Object element, RefactoringArguments arguments) {
- this.addType((IType) element);
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
deleted file mode 100644
index faa035ba20..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java
+++ /dev/null
@@ -1,239 +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.jpa.core.internal.refactoring;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
-import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
-import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
-import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * Participant in the move refactoring of {@link IFolders}s.
- * Any mapping file references in the persistence.xml will be updated to reflect the new location.
- */
-public class JpaMoveFolderParticipant
- extends MoveParticipant
- implements ISharableParticipant
-{
-
- /**
- * Store the {@link IFolder}s to be moved and their corresponding MoveArguments
- */
- protected final Map<IFolder, MoveArguments> originalFolders;
-
- /**
- * Store the persistence.xml ReplaceEdit in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlReplaceEdits;
-
- public JpaMoveFolderParticipant() {
- super();
- this.originalFolders = new HashMap<IFolder, MoveArguments>();
- this.persistenceXmlReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_PARTICIPANT_NAME;
- }
-
- @Override
- protected boolean initialize(Object element) {
- if (!getArguments().getUpdateReferences()) {
- return false;
- }
- this.addElement(element, getArguments());
- return true;
- }
-
- //****************ISharableParticipant implementation *****************
-
- /**
- * This is used when multiple folders are moved.
- * RefactoringParticipant#initialize(Object) is called for the first moved IFolder.
- * RefactoringParticipant#getArguments() only applies to the first moved IFolder.
- */
- public void addElement(Object element, RefactoringArguments arguments) {
- this.originalFolders.put((IFolder) element, (MoveArguments) arguments);
- }
-
- protected MoveArguments getArguments(IFolder element) {
- return this.originalFolders.get(element);
- }
-
-
- //**************** RefactoringParticipant implementation *****************
-
- /**
- * Inform the refactoring processor of any files that are going to change. In the process of determining
- * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
- //since the progress bar will hang if a large JPA project is being loaded,
- //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
- monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
- JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
- if (jpaProjectManager.getJpaProjectsSize() == 0) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
- sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME);
- ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
- IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
-
- for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
- this.createReplaceEdits(jpaProject);
- sm.worked(10);
- }
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
- deltaFactory.change(persistenceXmlFile);
- }
- sm.worked(1);
-
- return null;
- }
-
- protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException {
- PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
- if (persistenceUnit == null) {
- return;
- }
- Iterable<ReplaceEdit> replaceEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit);
- if (!CollectionTools.isEmpty(replaceEdits)) {
- this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits);
- }
- }
-
- @Override
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (this.persistenceXmlReplaceEdits.isEmpty()) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size());
- sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME);
- CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_CHANGE_NAME);
- for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- this.addPersistenceXmlRenameChange(persistenceXmlFile, compositeChange);
- }
- //must check for children in case all changes were made in other participants TextChanges,
- //want to return null so our node does not appear in the preview tree
- return compositeChange.getChildren().length == 0 ? null : compositeChange;
- }
-
- protected Iterable<ReplaceEdit> createPersistenceUnitReplaceEditsCheckClasspath(final PersistenceUnit persistenceUnit) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<IFolder, Iterable<ReplaceEdit>>(this.getOriginalFoldersOnClasspath(persistenceUnit.getJpaProject())) {
- @Override
- protected Iterable<ReplaceEdit> transform(IFolder folder) {
- return createPersistenceUnitReplaceEdits(persistenceUnit, folder, (IContainer) getArguments(folder).getDestination());
- }
- }
- );
- }
-
- protected Iterable<IFolder> getOriginalFoldersOnClasspath(final JpaProject jpaProject) {
- final IJavaProject javaProject = jpaProject.getJavaProject();
- return new FilteringIterable<IFolder>(this.originalFolders.keySet()) {
- @Override
- protected boolean accept(IFolder folder) {
- return javaProject.isOnClasspath(folder);
- }
- };
- }
-
- protected Iterable<ReplaceEdit> createPersistenceUnitReplaceEdits(PersistenceUnit persistenceUnit, IFolder folder, IContainer destination) {
- IProject project = destination.getProject();
- IPath fullPath = destination.getFullPath().append(folder.getName());
- IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath);
- return persistenceUnit.createMoveFolderEdits(folder, runtimePath);
- }
-
- protected void addPersistenceXmlRenameChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
- TextChange textChange = getTextChange(persistenceXmlFile);
- if (textChange == null) {
- textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
- MultiTextEdit multiTextEdit = new MultiTextEdit();
- textChange.setEdit(multiTextEdit);
- compositeChange.add(textChange);
- }
- Iterable<ReplaceEdit> mappingFileReplaceEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile);
- this.addEdits(textChange, mappingFileReplaceEdits);
- }
-
- private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return null;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return null;
- }
- if (persistence.getPersistenceUnitsSize() != 1) {
- return null; // the context model currently only supports 1 persistence unit
- }
- return persistence.getPersistenceUnits().iterator().next();
- }
-
- private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
- for (TextEdit textEdit : textEdits) {
- try {
- textChange.addEdit(textEdit);
- }
- catch (MalformedTreeException e) {
- //log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
deleted file mode 100644
index e26e694930..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java
+++ /dev/null
@@ -1,242 +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.jpa.core.internal.refactoring;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jpt.common.core.JptCommonCorePlugin;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant;
-import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
-import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
-import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * Participant in the rename refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
- * If the renamed mapping file is listed in a persistence.xml file of any JpaProject
- * then a Change object is created that will rename that reference from the file.
- * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified.
- */
-public class JpaMoveMappingFileParticipant
- extends MoveParticipant
- implements ISharableParticipant
-{
-
- /**
- * Store the {@link IFile}s to be renamed with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
- * and their corresponding {@link MoveArguments}
- */
- protected final Map<IFile, MoveArguments> originalMappingFiles;
-
- /**
- * Store the persistence.xml ReplaceEdit in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlMappingFileReplaceEdits;
-
- public JpaMoveMappingFileParticipant() {
- super();
- this.originalMappingFiles = new HashMap<IFile, MoveArguments>();
- this.persistenceXmlMappingFileReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
- }
-
- @Override
- protected boolean initialize(Object element) {
- if (!getArguments().getUpdateReferences()) {
- return false;
- }
- this.addElement(element, getArguments());
- return true;
- }
-
- //****************ISharableParticipant implementation *****************
-
- /**
- * This is used when multiple mapping files are deleted.
- * RefactoringParticipant#initialize(Object) is called for the first deleted IFile.
- * RefactoringParticipant#getArguments() only applies to the first deleted IFile
- */
- public void addElement(Object element, RefactoringArguments arguments) {
- this.originalMappingFiles.put((IFile) element, (MoveArguments) arguments);
- }
-
- protected MoveArguments getArguments(IFile element) {
- return this.originalMappingFiles.get(element);
- }
-
-
- //**************** RefactoringParticipant implementation *****************
-
- /**
- * Inform the refactoring processor of any files that are going to change. In the process of determining
- * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
- //since the progress bar will hang if a large JPA project is being loaded,
- //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
- monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
- JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
- if (jpaProjectManager.getJpaProjectsSize() == 0) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
- sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
- ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
- IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
-
- for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
- this.createReplaceEdits(jpaProject);
- sm.worked(10);
- }
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) {
- deltaFactory.change(persistenceXmlFile);
- }
- sm.worked(1);
-
- return null;
- }
-
- protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException {
- PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
- if (persistenceUnit == null) {
- return;
- }
- Iterable<ReplaceEdit> replaceEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit);
- if (!CollectionTools.isEmpty(replaceEdits)) {
- this.persistenceXmlMappingFileReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits);
- }
- }
-
- @Override
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (this.persistenceXmlMappingFileReplaceEdits.isEmpty()) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileReplaceEdits.size());
- sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
- CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_NAME);
- for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) {
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- this.addPersistenceXmlRenameMappingFileChange(persistenceXmlFile, compositeChange);
- }
- //must check for children in case all changes were made in other participants TextChanges,
- //want to return null so our node does not appear in the preview tree
- return compositeChange.getChildren().length == 0 ? null : compositeChange;
- }
-
-
- protected Iterable<ReplaceEdit> createPersistenceUnitReplaceEditsCheckClasspath(final PersistenceUnit persistenceUnit) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<IFile, Iterable<ReplaceEdit>>(this.getOriginalFoldersOnClasspath(persistenceUnit.getJpaProject())) {
- @Override
- protected Iterable<ReplaceEdit> transform(IFile mappingFile) {
- return createPersistenceUnitReplaceEdits(persistenceUnit, mappingFile, (IFolder) getArguments(mappingFile).getDestination());
- }
- }
- );
- }
-
- protected Iterable<IFile> getOriginalFoldersOnClasspath(final JpaProject jpaProject) {
- final IJavaProject javaProject = jpaProject.getJavaProject();
- return new FilteringIterable<IFile>(this.originalMappingFiles.keySet()) {
- @Override
- protected boolean accept(IFile file) {
- return javaProject.isOnClasspath(file);
- }
- };
- }
-
- private Iterable<ReplaceEdit> createPersistenceUnitReplaceEdits(PersistenceUnit persistenceUnit, IFile mappingFile, IFolder destination) {
- IProject project = destination.getProject();
- IPath fullPath = destination.getFullPath();
- IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath);
- return persistenceUnit.createMoveMappingFileEdits(mappingFile, runtimePath);
- }
-
- protected void addPersistenceXmlRenameMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
- TextChange textChange = getTextChange(persistenceXmlFile);
- if (textChange == null) {
- textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
- MultiTextEdit multiTextEdit = new MultiTextEdit();
- textChange.setEdit(multiTextEdit);
- compositeChange.add(textChange);
- }
- Iterable<ReplaceEdit> mappingFileReplaceEdits = this.persistenceXmlMappingFileReplaceEdits.get(persistenceXmlFile);
- this.addEdits(textChange, mappingFileReplaceEdits);
- }
-
- private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return null;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return null;
- }
- if (persistence.getPersistenceUnitsSize() != 1) {
- return null; // the context model currently only supports 1 persistence unit
- }
- return persistence.getPersistenceUnits().iterator().next();
- }
-
- private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
- for (TextEdit textEdit : textEdits) {
- try {
- textChange.addEdit(textEdit);
- }
- catch (MalformedTreeException e) {
- //log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java
deleted file mode 100644
index 969ad22c60..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.refactoring;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class JpaMoveTypeParticipant
- extends AbstractJpaMoveJavaElementParticipant {
-
- public JpaMoveTypeParticipant() {
- super();
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_PARTICIPANT_NAME;
- }
-
- @Override
- public void addElement(Object element, RefactoringArguments arguments) {
- super.addElement(element, arguments);
- this.addNestedTypes((IType) element, arguments);
- }
-
- protected void addNestedType(IType renamedType, RefactoringArguments arguments) {
- super.addElement(renamedType, arguments);
- this.addNestedTypes(renamedType, arguments);
- }
-
- private void addNestedTypes(IType renamedType, RefactoringArguments arguments) {
- IType[] nestedTypes;
- try {
- nestedTypes = renamedType.getTypes();
- }
- catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return;
- }
-
- for (IType nestedType : nestedTypes) {
- this.addNestedType(nestedType, arguments);
- }
- }
-
-
- //**************** AbstractJpaRenameJavaElementParticipant implementation *****************
-
- @Override
- protected Iterable<ReplaceEdit> createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit, IJavaElement javaElement, Object destination) {
- IType type = (IType) javaElement;
- if (((IJavaElement) destination).getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
- return persistenceUnit.createMoveTypeEdits(type, (IPackageFragment) destination);
- }
- return persistenceUnit.createRenameTypeEdits(type, getNewNameForNestedType(type, (IType) destination));
- }
-
- @Override
- protected Iterable<ReplaceEdit> createMappingFileReplaceEdits(MappingFileRef mappingFileRef, IJavaElement javaElement, Object destination) {
- IType type = (IType) javaElement;
- if (((IJavaElement) destination).getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
- return mappingFileRef.createMoveTypeEdits(type, (IPackageFragment) destination);
- }
- return mappingFileRef.createRenameTypeEdits(type, getNewNameForNestedType(type, (IType) destination));
- }
-
- protected String getNewNameForNestedType(IType nestedType, IType destination) {
- return nestedType.getTypeQualifiedName('$').replaceFirst(nestedType.getDeclaringType().getElementName(), destination.getElementName());
- }
-
- protected IPackageFragment getNewPackage() {
- return (IPackageFragment) getArguments().getDestination();
- }
-
- @Override
- protected String getCheckConditionsSubTaskName() {
- return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME;
- }
-
- @Override
- protected String getCreateChangeSubTaskName() {
- return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME;
- }
-
- @Override
- protected String getCompositeChangeName() {
- return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_NAME;
- }
-
- @Override
- protected String getPersistenceXmlChangeName() {
- return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- }
-
- @Override
- protected String getMappingFileChangeName() {
- return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
deleted file mode 100644
index 268b0d74b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java
+++ /dev/null
@@ -1,194 +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.jpa.core.internal.refactoring;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
-import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * Participant in the rename refactoring of {@link IFolders}s.
- * If the renamed mapping file is listed in a persistence.xml file of any JpaProject
- * then a Change object is created that will rename that reference from the file.
- * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified.
- */
-public class JpaRenameFolderParticipant
- extends RenameParticipant
-{
-
- /**
- * Store the {@link IFolder}s to be renamed
- */
-
- protected IFolder originalFolder;
-
- /**
- * Store the persistence.xml ReplaceEdit in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlReplaceEdits;
-
- public JpaRenameFolderParticipant() {
- super();
- this.persistenceXmlReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_PARTICIPANT_NAME;
- }
-
- @Override
- protected boolean initialize(Object element) {
- if (!getArguments().getUpdateReferences()) {
- return false;
- }
- this.originalFolder = (IFolder) element;
- return true;
- }
-
-
- //**************** RefactoringParticipant implementation *****************
-
- /**
- * Inform the refactoring processor of any files that are going to change. In the process of determining
- * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
- //since the progress bar will hang if a large JPA project is being loaded,
- //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
- monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
- JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
- if (jpaProjectManager.getJpaProjectsSize() == 0) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
- sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME);
- ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
- IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
-
- for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
- this.createReplaceEdits(jpaProject);
- sm.worked(10);
- }
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
- deltaFactory.change(persistenceXmlFile);
- }
- sm.worked(1);
-
- return null;
- }
-
- protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException {
- PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
- if (persistenceUnit == null) {
- return;
- }
- Iterable<ReplaceEdit> replaceEdits = this.createPersistenceUnitReplaceEdits(persistenceUnit);
- if (!CollectionTools.isEmpty(replaceEdits)) {
- this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits);
- }
- }
-
- @Override
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (this.persistenceXmlReplaceEdits.isEmpty()) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size());
- sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME);
- CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_CHANGE_NAME);
- for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) {
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- this.addPersistenceXmlRenameChange(persistenceXmlFile, compositeChange);
- }
- //must check for children in case all changes were made in other participants TextChanges,
- //want to return null so our node does not appear in the preview tree
- return compositeChange.getChildren().length == 0 ? null : compositeChange;
- }
-
- private Iterable<ReplaceEdit> createPersistenceUnitReplaceEdits(final PersistenceUnit persistenceUnit) {
- if (persistenceUnit.getJpaProject().getJavaProject().isOnClasspath(this.originalFolder) || persistenceUnit.getJpaProject().getProject() == this.originalFolder.getProject()) {
- return persistenceUnit.createRenameFolderEdits(this.originalFolder, getArguments().getNewName());
- }
- return EmptyIterable.instance();
- }
-
- protected void addPersistenceXmlRenameChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
- TextChange textChange = getTextChange(persistenceXmlFile);
- if (textChange == null) {
- textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
- MultiTextEdit multiTextEdit = new MultiTextEdit();
- textChange.setEdit(multiTextEdit);
- compositeChange.add(textChange);
- }
- Iterable<ReplaceEdit> mappingFileReplaceEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile);
- this.addEdits(textChange, mappingFileReplaceEdits);
- }
-
- private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return null;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return null;
- }
- if (persistence.getPersistenceUnitsSize() != 1) {
- return null; // the context model currently only supports 1 persistence unit
- }
- return persistence.getPersistenceUnits().iterator().next();
- }
-
- private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
- for (TextEdit textEdit : textEdits) {
- try {
- textChange.addEdit(textEdit);
- }
- catch (MalformedTreeException e) {
- //log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
deleted file mode 100644
index e4e18412dd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java
+++ /dev/null
@@ -1,189 +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.jpa.core.internal.refactoring;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JpaProjectManager;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.TextChange;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
-import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
-import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker;
-import org.eclipse.text.edits.MalformedTreeException;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- * Participant in the rename refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}.
- * If the renamed mapping file is listed in a persistence.xml file of any JpaProject
- * then a Change object is created that will rename that reference from the file.
- * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified.
- */
-public class JpaRenameMappingFileParticipant
- extends RenameParticipant
-{
-
- /**
- * Store the {@link IFile}s to be renamed with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}
- */
-
- protected IFile originalMappingFile;
-
- /**
- * Store the persistence.xml ReplaceEdit in the checkConditions() call
- * to avoid duplicated effort in createChange().
- */
- protected final Map<IFile, Iterable<ReplaceEdit>> persistenceXmlMappingFileReplaceEdits;
-
- public JpaRenameMappingFileParticipant() {
- super();
- this.persistenceXmlMappingFileReplaceEdits = new HashMap<IFile, Iterable<ReplaceEdit>>();
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME;
- }
-
- @Override
- protected boolean initialize(Object element) {
- if (!getArguments().getUpdateReferences()) {
- return false;
- }
- this.originalMappingFile = (IFile) element;
- return true;
- }
-
-
- //**************** RefactoringParticipant implementation *****************
-
- /**
- * Inform the refactoring processor of any files that are going to change. In the process of determining
- * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange()
- */
- @Override
- public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException {
- //since the progress bar will hang if a large JPA project is being loaded,
- //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called.
- monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME);
- JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager();
- if (jpaProjectManager.getJpaProjectsSize() == 0) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1);
- sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
- ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
- IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory();
-
- for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) {
- this.createReplaceEdits(jpaProject);
- sm.worked(10);
- }
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) {
- deltaFactory.change(persistenceXmlFile);
- }
- sm.worked(1);
-
- return null;
- }
-
- protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException {
- PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject);
- if (persistenceUnit == null) {
- return;
- }
- Iterable<ReplaceEdit> replaceEdits = this.createMappingFileRefReplaceEdits(persistenceUnit);
- if (!CollectionTools.isEmpty(replaceEdits)) {
- this.persistenceXmlMappingFileReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits);
- }
- }
-
- @Override
- public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- if (this.persistenceXmlMappingFileReplaceEdits.isEmpty()) {
- return null;
- }
- SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileReplaceEdits.size());
- sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME);
- CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_NAME);
- for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) {
- if (sm.isCanceled()) {
- throw new OperationCanceledException();
- }
- this.addPersistenceXmlRenameMappingFileChange(persistenceXmlFile, compositeChange);
- }
- //must check for children in case all changes were made in other participants TextChanges,
- //want to return null so our node does not appear in the preview tree
- return compositeChange.getChildren().length == 0 ? null : compositeChange;
- }
-
- private Iterable<ReplaceEdit> createMappingFileRefReplaceEdits(final PersistenceUnit persistenceUnit) {
- return persistenceUnit.createRenameMappingFileEdits(this.originalMappingFile, getArguments().getNewName());
- }
-
- protected void addPersistenceXmlRenameMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) {
- TextChange textChange = getTextChange(persistenceXmlFile);
- if (textChange == null) {
- textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile);
- MultiTextEdit multiTextEdit = new MultiTextEdit();
- textChange.setEdit(multiTextEdit);
- compositeChange.add(textChange);
- }
- Iterable<ReplaceEdit> mappingFileReplaceEdits = this.persistenceXmlMappingFileReplaceEdits.get(persistenceXmlFile);
- this.addEdits(textChange, mappingFileReplaceEdits);
- }
-
- private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) {
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return null;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return null;
- }
- if (persistence.getPersistenceUnitsSize() != 1) {
- return null; // the context model currently only supports 1 persistence unit
- }
- return persistence.getPersistenceUnits().iterator().next();
- }
-
- private void addEdits(TextChange textChange, Iterable<? extends TextEdit> textEdits) {
- for (TextEdit textEdit : textEdits) {
- try {
- textChange.addEdit(textEdit);
- }
- catch (MalformedTreeException e) {
- //log exception and don't add this persistence.xml type deletion to the conflicting change object
- JptJpaCorePlugin.log(e);
- }
- }
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java
deleted file mode 100644
index 830c6c86be..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.refactoring;
-
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class JpaRenamePackageParticipant
- extends AbstractJpaRenameJavaElementParticipant {
-
-
- public JpaRenamePackageParticipant() {
- super();
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_PARTICIPANT_NAME;
- }
-
- protected IPackageFragment getOriginalPackage() {
- return (IPackageFragment) super.getOriginalJavaElement();
- }
-
-
- //**************** AbstractJpaRenameJavaElementParticipant implementation *****************
-
- @Override
- protected Iterable<ReplaceEdit> createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit) {
- return persistenceUnit.createRenamePackageEdits(this.getOriginalPackage(), this.getNewName());
- }
-
- @Override
- protected Iterable<ReplaceEdit> createMappingFileReplaceEdits(MappingFileRef mappingFileRef) {
- return mappingFileRef.createRenamePackageEdits(this.getOriginalPackage(), this.getNewName());
- }
-
- protected String getNewName() {
- return getArguments().getNewName();
- }
-
- @Override
- protected String getCheckConditionsSubTaskName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME;
- }
-
- @Override
- protected String getCreateChangeSubTaskName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME;
- }
-
- @Override
- protected String getCompositeChangeName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_NAME;
- }
-
- @Override
- protected String getPersistenceXmlChangeName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- }
-
- @Override
- protected String getMappingFileChangeName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java
deleted file mode 100644
index c72b74c34c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.refactoring;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.text.edits.ReplaceEdit;
-
-//TODO RenameTypeArguments.updateSimilarDeclarations() - http://www.eclipse.org/jdt/ui/r3_2/RenameType.html
-public class JpaRenameTypeParticipant
- extends AbstractJpaRenameJavaElementParticipant {
-
- protected final Collection<IType> nestedTypes;
-
- public JpaRenameTypeParticipant() {
- super();
- this.nestedTypes = new ArrayList<IType>();
- }
-
- @Override
- public String getName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_PARTICIPANT_NAME;
- }
-
- protected IType getOriginalType() {
- return (IType) super.getOriginalJavaElement();
- }
-
- @Override
- protected boolean initialize(Object element) {
- boolean initialize = super.initialize(element);
- if (initialize) {
- this.addNestedTypes(this.getOriginalType());
- return true;
- }
- return false;
- }
-
- protected void addNestedType(IType renamedType) {
- this.nestedTypes.add(renamedType);
- this.addNestedTypes(renamedType);
- }
-
- private void addNestedTypes(IType renamedType) {
- IType[] nestedTypes;
- try {
- nestedTypes = renamedType.getTypes();
- }
- catch (JavaModelException ex) {
- JptJpaCorePlugin.log(ex);
- return;
- }
-
- for (IType nestedType : nestedTypes) {
- this.addNestedType(nestedType);
- }
- }
-
-
- //**************** AbstractJpaRenameJavaElementParticipant implementation *****************
-
- @SuppressWarnings("unchecked")
- @Override
- protected Iterable<ReplaceEdit> createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit) {
- return new CompositeIterable<ReplaceEdit>(
- this.createPersistenceXmlReplaceOriginalTypeEdits(persistenceUnit),
- this.createPersistenceXmlReplaceNestedTypeEdits(persistenceUnit));
- }
-
- private Iterable<ReplaceEdit> createPersistenceXmlReplaceOriginalTypeEdits(PersistenceUnit persistenceUnit) {
- return persistenceUnit.createRenameTypeEdits(this.getOriginalType(), this.getNewName());
- }
-
- private Iterable<ReplaceEdit> createPersistenceXmlReplaceNestedTypeEdits(final PersistenceUnit persistenceUnit) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<IType, Iterable<ReplaceEdit>>(this.nestedTypes) {
- @Override
- protected Iterable<ReplaceEdit> transform(IType nestedType) {
- String newName = getNewNameForNestedType(nestedType);
- return persistenceUnit.createRenameTypeEdits(nestedType, newName);
- }
- }
- );
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected Iterable<ReplaceEdit> createMappingFileReplaceEdits(MappingFileRef mappingFileRef) {
- return new CompositeIterable<ReplaceEdit>(
- this.createMappingFileReplaceOriginalTypeEdits(mappingFileRef),
- this.createMappingFileReplaceNestedTypeEdits(mappingFileRef));
- }
-
- private Iterable<ReplaceEdit> createMappingFileReplaceOriginalTypeEdits(MappingFileRef mappingFileRef) {
- return mappingFileRef.createRenameTypeEdits(this.getOriginalType(), this.getNewName());
- }
-
- private Iterable<ReplaceEdit> createMappingFileReplaceNestedTypeEdits(final MappingFileRef mappingFileRef) {
- return new CompositeIterable<ReplaceEdit>(
- new TransformationIterable<IType, Iterable<ReplaceEdit>>(this.nestedTypes) {
- @Override
- protected Iterable<ReplaceEdit> transform(IType nestedType) {
- String newName = getNewNameForNestedType(nestedType);
- return mappingFileRef.createRenameTypeEdits(nestedType, newName);
- }
- }
- );
- }
-
- protected String getNewName() {
- String newName = getArguments().getNewName();
- try {
- if (this.getOriginalType().isMember()) {
- newName = this.getOriginalType().getTypeQualifiedName().substring(0, this.getOriginalType().getTypeQualifiedName().lastIndexOf('$')) + '$' + newName;
- }
- }
- catch (JavaModelException e) {
- JptJpaCorePlugin.log(e);
- }
- return newName;
- }
-
- protected String getNewNameForNestedType(IType nestedType) {
- return nestedType.getTypeQualifiedName('$').replaceFirst(this.getOriginalType().getElementName(), getArguments().getNewName());
- }
-
- @Override
- protected String getCheckConditionsSubTaskName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME;
- }
-
- @Override
- protected String getCreateChangeSubTaskName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME;
- }
-
- @Override
- protected String getCompositeChangeName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_NAME;
- }
-
- @Override
- protected String getPersistenceXmlChangeName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME;
- }
-
- @Override
- protected String getMappingFileChangeName() {
- return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java
deleted file mode 100644
index 7f5320de28..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.resource.contenttypes;
-
-import java.io.InputStream;
-import java.io.Reader;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.ITextContentDescriber;
-
-/**
- * This class simply returns INDETERMINATE for any contents it receives.
- *
- * It is used currently for org.eclipse.jpt.jpa.core.content.baseJpaContent in order
- * to make that content type act as an "abstract" content type.
- *
- * This is in its own package so that it can be excluded from bundle activation in the plugin.xml.
- * Content describers must be self-contained and not trigger auto-activation.
- */
-public class IndeterminateContentDescriber implements ITextContentDescriber
-{
- public int describe(InputStream contents, IContentDescription description) {
- return INDETERMINATE;
- }
-
- public int describe(Reader contents, IContentDescription description) {
- return INDETERMINATE;
- }
-
- public QualifiedName[] getSupportedOptions() {
- return new QualifiedName[0];
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
deleted file mode 100644
index a1e61a1caa..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryAssociationOverride1_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceAssociationOverride1_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public final class AssociationOverrideAnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new AssociationOverrideAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AssociationOverrideAnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceAssociationOverride1_0Annotation.buildSourceAssociationOverrideAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryAssociationOverride1_0Annotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.ASSOCIATION_OVERRIDE;
- }
-
- public String getContainerAnnotationName() {
- return JPA.ASSOCIATION_OVERRIDES;
- }
-
- public String getElementName() {
- return JPA.ASSOCIATION_OVERRIDES__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
deleted file mode 100644
index e93bec5a59..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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 Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
- }
-
- public String getAnnotationName() {
- return JPA.ASSOCIATION_OVERRIDES;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
deleted file mode 100644
index a675fbecce..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.AttributeOverride
- */
-public final class AttributeOverrideAnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new AttributeOverrideAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private AttributeOverrideAnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceAttributeOverrideAnnotation.buildSourceAttributeOverrideAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryAttributeOverrideAnnotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.ATTRIBUTE_OVERRIDE;
- }
-
- public String getContainerAnnotationName() {
- return JPA.ATTRIBUTE_OVERRIDES;
- }
-
- public String getElementName() {
- return JPA.ATTRIBUTE_OVERRIDES__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
deleted file mode 100644
index c21211186b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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 Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
- }
-
- public String getAnnotationName() {
- return JPA.ATTRIBUTE_OVERRIDES;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java
deleted file mode 100644
index d5c9f819af..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBasicAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBasicAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryBasicAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return BasicAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java
deleted file mode 100644
index be971f01c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryColumnAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-
-/**
- * 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(parent, annotatedElement, SourceColumnAnnotation.MAPPING_DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullColumnAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryColumnAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ColumnAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java
deleted file mode 100644
index 8869b15e8c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryDiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceDiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullDiscriminatorColumnAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryDiscriminatorColumnAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return DiscriminatorColumnAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
deleted file mode 100644
index 4fe3535e79..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryDiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceDiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullDiscriminatorValueAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryDiscriminatorValueAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return DiscriminatorValueAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java
deleted file mode 100644
index b11237dddc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddableAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EmbeddableAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java
deleted file mode 100644
index dc28ee26da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddedAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddedAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EmbeddedAnnotation.ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
deleted file mode 100644
index 840fdefbed..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddedIdAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddedIdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEmbeddedIdAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EmbeddedIdAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java
deleted file mode 100644
index 23dbdb233a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEntityAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEntityAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEntityAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EntityAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java
deleted file mode 100644
index b338ee24e9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullEnumeratedAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryEnumeratedAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return EnumeratedAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
deleted file mode 100644
index 5c0a3d01c5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryGeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceGeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryGeneratedValueAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return GeneratedValueAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java
deleted file mode 100644
index c446b333a3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryIdAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryIdAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return IdAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java
deleted file mode 100644
index 05b066cd93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryIdClassAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryIdClassAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return IdClassAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java
deleted file mode 100644
index 8b39be25b4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryInheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceInheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
-
-/**
- * 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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullInheritanceAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryInheritanceAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return InheritanceAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java
deleted file mode 100644
index ee175d09dd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.JoinColumn
- */
-public final class JoinColumnAnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new JoinColumnAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private JoinColumnAnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceJoinColumnAnnotation.buildSourceJoinColumnAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryJoinColumnAnnotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.JOIN_COLUMN;
- }
-
- public String getContainerAnnotationName() {
- return JPA.JOIN_COLUMNS;
- }
-
- public String getElementName() {
- return JPA.JOIN_COLUMNS__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
deleted file mode 100644
index ffe0e7c815..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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 Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
- }
-
- public String getAnnotationName() {
- return JPA.JOIN_COLUMNS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java
deleted file mode 100644
index 3f3894be12..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullJoinTableAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryJoinTableAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return JoinTableAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java
deleted file mode 100644
index 941bf6e2a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryLobAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceLobAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryLobAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return LobAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java
deleted file mode 100644
index e96d01e153..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryManyToManyAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceManyToManyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryManyToManyAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ManyToManyAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java
deleted file mode 100644
index e2c9537623..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryManyToOneAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceManyToOneAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryManyToOneAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ManyToOneAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java
deleted file mode 100644
index caa04880dc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryMapKeyAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceMapKeyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMapKeyAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MapKeyAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
deleted file mode 100644
index bc83790cf6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryMappedSuperclassAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceMappedSuperclassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryMappedSuperclassAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return MappedSuperclassAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
deleted file mode 100644
index 43ad8a23d2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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 SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
- }
-
- public String getAnnotationName() {
- return JPA.NAMED_NATIVE_QUERIES;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
deleted file mode 100644
index 804b262156..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.NamedNativeQuery
- */
-public final class NamedNativeQueryAnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new NamedNativeQueryAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NamedNativeQueryAnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceNamedNativeQueryAnnotation.buildSourceNamedNativeQueryAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryNamedNativeQueryAnnotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.NAMED_NATIVE_QUERY;
- }
-
- public String getContainerAnnotationName() {
- return JPA.NAMED_NATIVE_QUERIES;
- }
-
- public String getElementName() {
- return JPA.NAMED_NATIVE_QUERIES__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
deleted file mode 100644
index 855f933404..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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 SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
- }
-
- public String getAnnotationName() {
- return JPA.NAMED_QUERIES;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java
deleted file mode 100644
index 397442f380..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryNamedQuery1_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.NamedQuery
- */
-public final class NamedQueryAnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new NamedQueryAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private NamedQueryAnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceNamedQuery1_0Annotation.buildSourceNamedQueryAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryNamedQuery1_0Annotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.NAMED_QUERY;
- }
-
- public String getContainerAnnotationName() {
- return JPA.NAMED_QUERIES;
- }
-
- public String getElementName() {
- return JPA.NAMED_QUERIES__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java
deleted file mode 100644
index 8271825126..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.resource.java;
-
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-
-/**
- * <code>javax.persistence.Column</code>
- */
-public final class NullAttributeOverrideColumnAnnotation
- extends NullColumnAnnotation
-{
- public NullAttributeOverrideColumnAnnotation(AttributeOverrideAnnotation parent) {
- super(parent);
- }
-
- private AttributeOverrideAnnotation getAttributeOverrideAnnotation() {
- return (AttributeOverrideAnnotation) this.parent;
- }
-
- @Override
- protected ColumnAnnotation addAnnotation() {
- return this.getAttributeOverrideAnnotation().addColumn();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java
deleted file mode 100644
index 9ab6d373cb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java
+++ /dev/null
@@ -1,110 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
-
-/**
- * <ul>
- * <li><code>javax.persistence.Column</code>
- * <li><code>javax.persistence.JoinColumn</code>
- * <li><code>javax.persistence.MapKeyColumn</code>
- * </ul>
- */
-public abstract class NullBaseColumnAnnotation<A extends BaseColumnAnnotation>
- extends NullNamedColumnAnnotation<A>
- implements BaseColumnAnnotation
-{
- protected NullBaseColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- // ***** table
- public String getTable() {
- return null;
- }
-
- public void setTable(String table) {
- if (table != null) {
- this.addAnnotation().setTable(table);
- }
- }
-
- public TextRange getTableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean tableTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** unique
- public Boolean getUnique() {
- return null;
- }
-
- public void setUnique(Boolean unique) {
- if (unique != null) {
- this.addAnnotation().setUnique(unique);
- }
- }
-
- public TextRange getUniqueTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** updatable
- public Boolean getUpdatable() {
- return null;
- }
-
- public void setUpdatable(Boolean updatable) {
- if (updatable != null) {
- this.addAnnotation().setUpdatable(updatable);
- }
- }
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** insertable
- public Boolean getInsertable() {
- return null;
- }
-
- public void setInsertable(Boolean insertable) {
- if (insertable != null) {
- this.addAnnotation().setInsertable(insertable);
- }
- }
-
- public TextRange getInsertableTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** nullable
- public Boolean getNullable() {
- return null;
- }
-
- public void setNullable(Boolean nullable) {
- if (nullable != null) {
- this.addAnnotation().setNullable(nullable);
- }
- }
-
- public TextRange getNullableTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java
deleted file mode 100644
index b1fd557867..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java
+++ /dev/null
@@ -1,121 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-
-/**
- * <ul>
- * <li><code>javax.persistence.Table</code>
- * <li><code>javax.persistence.JoinTable</code>
- * <li><code>javax.persistence.CollectionTable</code>
- * <ul>
- */
-public abstract class NullBaseTableAnnotation<A extends BaseTableAnnotation>
- extends NullAnnotation<A>
- implements BaseTableAnnotation
-{
- protected NullBaseTableAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public boolean isSpecified() {
- return false;
- }
-
- // ***** name
- public String getName() {
- return null;
- }
-
- public void setName(String name) {
- if (name != null) {
- this.addAnnotation().setName(name);
- }
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** schema
- public String getSchema() {
- return null;
- }
-
- public void setSchema(String schema) {
- if (schema != null) {
- this.addAnnotation().setSchema(schema);
- }
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** catalog
- public String getCatalog() {
- return null;
- }
-
- public void setCatalog(String catalog) {
- if (catalog != null) {
- this.addAnnotation().setCatalog(catalog);
- }
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** unique constraints
- public ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
- return EmptyListIterable.instance();
- }
-
- public int getUniqueConstraintsSize() {
- return 0;
- }
-
- public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
- throw new UnsupportedOperationException();
- }
-
- public UniqueConstraintAnnotation addUniqueConstraint(int index) {
- return this.addAnnotation().addUniqueConstraint(index);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java
deleted file mode 100644
index 3cf4c61ed3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java
+++ /dev/null
@@ -1,76 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-
-/**
- * <code>javax.persistence.Column</code>
- */
-public class NullColumnAnnotation
- extends NullBaseColumnAnnotation<ColumnAnnotation>
- implements ColumnAnnotation
-{
- public NullColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** length
- public Integer getLength() {
- return null;
- }
-
- public void setLength(Integer length) {
- if (length != null) {
- this.addAnnotation().setLength(length);
- }
- }
-
- public TextRange getLengthTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** scale
- public Integer getScale() {
- return null;
- }
-
- public void setScale(Integer scale) {
- if (scale != null) {
- this.addAnnotation().setScale(scale);
- }
- }
-
- public TextRange getScaleTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- // ***** precision
- public Integer getPrecision() {
- return null;
- }
-
- public void setPrecision(Integer precision) {
- if (precision != null) {
- this.addAnnotation().setPrecision(precision);
- }
- }
-
- public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
deleted file mode 100644
index 9b368a5175..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,52 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
-
-/**
- * <code>javax.persistence.DiscriminatorColumn</code>
- */
-public final class NullDiscriminatorColumnAnnotation
- extends NullNamedColumnAnnotation<DiscriminatorColumnAnnotation>
- implements DiscriminatorColumnAnnotation
-{
- public NullDiscriminatorColumnAnnotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** discriminator type
- public DiscriminatorType getDiscriminatorType() {
- return null;
- }
-
- public void setDiscriminatorType(DiscriminatorType discriminatorType) {
- if (discriminatorType != null) {
- this.addAnnotation().setDiscriminatorType(discriminatorType);
- }
- }
-
- // ***** length
- public Integer getLength() {
- return null;
- }
-
- public void setLength(Integer length) {
- if (length != null) {
- this.addAnnotation().setLength(length);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java
deleted file mode 100644
index 5614b6783c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
-
-/**
- * <code>javax.persistence.DiscriminatorValue</code>
- */
-public final class NullDiscriminatorValueAnnotation
- extends NullAnnotation<DiscriminatorValueAnnotation>
- implements DiscriminatorValueAnnotation
-{
- protected NullDiscriminatorValueAnnotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** value
- public String getValue() {
- return null;
- }
-
- public void setValue(String value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java
deleted file mode 100644
index 2f5348fa11..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java
+++ /dev/null
@@ -1,48 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.EnumType;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-
-/**
- * <code>javax.persistence.Enumerated</code>
- */
-public final class NullEnumeratedAnnotation
- extends NullAnnotation<EnumeratedAnnotation>
- implements EnumeratedAnnotation
-{
- protected NullEnumeratedAnnotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** value
- public EnumType getValue() {
- return null;
- }
-
- public void setValue(EnumType value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java
deleted file mode 100644
index b0108f3e0d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java
+++ /dev/null
@@ -1,48 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
-
-/**
- * <code>javax.persistence.Inheritance</code>
- */
-public final class NullInheritanceAnnotation
- extends NullAnnotation<InheritanceAnnotation>
- implements InheritanceAnnotation
-{
- protected NullInheritanceAnnotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** strategy
- public InheritanceType getStrategy() {
- return null;
- }
-
- public void setStrategy(InheritanceType strategy) {
- if (strategy != null) {
- this.addAnnotation().setStrategy(strategy);
- }
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java
deleted file mode 100644
index 2972666212..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java
+++ /dev/null
@@ -1,48 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-
-/**
- * <code>javax.persistence.JoinColumn</code>
- */
-public final class NullJoinColumnAnnotation
- extends NullBaseColumnAnnotation<JoinColumnAnnotation>
- implements JoinColumnAnnotation
-{
- public NullJoinColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** referenced column name
- public String getReferencedColumnName() {
- return null;
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java
deleted file mode 100644
index e1f72c0d31..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java
+++ /dev/null
@@ -1,84 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-
-/**
- * <code>javax.persistence.JoinTable</code>
- */
-public class NullJoinTableAnnotation
- extends NullBaseTableAnnotation<JoinTableAnnotation>
- implements JoinTableAnnotation
-{
- public NullJoinTableAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** join columns
- public ListIterable<JoinColumnAnnotation> getJoinColumns() {
- return EmptyListIterable.instance();
- }
-
- public int getJoinColumnsSize() {
- return 0;
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return null;
- }
-
- 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 ListIterable<JoinColumnAnnotation> getInverseJoinColumns() {
- return EmptyListIterable.instance();
- }
-
- public int getInverseJoinColumnsSize() {
- return 0;
- }
-
- public JoinColumnAnnotation inverseJoinColumnAt(int index) {
- return null;
- }
-
- public JoinColumnAnnotation addInverseJoinColumn(int index) {
- // the JoinTable annotation is missing, add both it and a join column at the same time
- return this.addAnnotation().addInverseJoinColumn(index);
- }
-
- public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeInverseJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java
deleted file mode 100644
index 60dae06fe0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java
+++ /dev/null
@@ -1,73 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
-
-/**
- * <ul>
- * <li><code>javax.persistence.Column</code>
- * <li><code>javax.persistence.JoinColumn</code>
- * <li><code>javax.persistence.MapKeyColumn</code>
- * <li><code>javax.persistence.DiscriminatorColumn</code>
- * <li><code>javax.persistence.OrderColumn</code>
- * <li><code>javax.persistence.PrimaryKeyJoinColumn</code>
- * </ul>
- */
-public abstract class NullNamedColumnAnnotation<A extends NamedColumnAnnotation>
- extends NullAnnotation<A>
- implements NamedColumnAnnotation
-{
- protected NullNamedColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public boolean isSpecified() {
- return false;
- }
-
- // ***** name
- public String getName() {
- return null;
- }
-
- public void setName(String name) {
- if (name != null) {
- this.addAnnotation().setName(name);
- }
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-
- // ***** column definition
- public String getColumnDefinition() {
- return null;
- }
-
- public void setColumnDefinition(String columnDefinition) {
- if (columnDefinition != null) {
- this.addAnnotation().setColumnDefinition(columnDefinition);
- }
- }
-
- public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index 2cc9e62b5a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,48 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-
-/**
- * <code>javax.persistence.PrimaryKeyJoinColumn</code>
- */
-public final class NullPrimaryKeyJoinColumnAnnotation
- extends NullNamedColumnAnnotation<PrimaryKeyJoinColumnAnnotation>
- implements PrimaryKeyJoinColumnAnnotation
-{
- public NullPrimaryKeyJoinColumnAnnotation(JavaResourceNode parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** referenced column name
- public String getReferencedColumnName() {
- return null;
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- return null;
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java
deleted file mode 100644
index 04dc531bac..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java
+++ /dev/null
@@ -1,29 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
-
-/**
- * <code>javax.persistence.Table</code>
- */
-public final class NullTableAnnotation
- extends NullBaseTableAnnotation<TableAnnotation>
- implements TableAnnotation
-{
- protected NullTableAnnotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java
deleted file mode 100644
index 2012d08b67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java
+++ /dev/null
@@ -1,48 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.NullAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
-
-/**
- * <code>javax.persistence.Temporal</code>
- */
-public final class NullTemporalAnnotation
- extends NullAnnotation<TemporalAnnotation>
- implements TemporalAnnotation
-{
- protected NullTemporalAnnotation(JavaResourceAnnotatedElement parent) {
- super(parent);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ***** value
- public TemporalType getValue() {
- return null;
- }
-
- public void setValue(TemporalType value) {
- if (value != null) {
- this.addAnnotation().setValue(value);
- }
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java
deleted file mode 100644
index 7f4fe98296..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOneToManyAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOneToManyAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToManyAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OneToManyAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java
deleted file mode 100644
index 89c2afb754..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOneToOneAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOneToOneAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryOneToOneAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OneToOneAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java
deleted file mode 100644
index a25b378539..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryOrderByAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceOrderByAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryOrderByAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return OrderByAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
deleted file mode 100644
index d2731c2bd9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumn
- */
-public final class PrimaryKeyJoinColumnAnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new PrimaryKeyJoinColumnAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private PrimaryKeyJoinColumnAnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourcePrimaryKeyJoinColumnAnnotation.buildSourcePrimaryKeyJoinColumnAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinaryPrimaryKeyJoinColumnAnnotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMN;
- }
-
- public String getContainerAnnotationName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMNS;
- }
-
- public String getElementName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMNS__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
deleted file mode 100644
index 8a48d9324e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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 Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) {
- return new SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
- }
-
- public String getAnnotationName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMNS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
deleted file mode 100644
index 0109ff4539..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java
+++ /dev/null
@@ -1,63 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
-import org.eclipse.jpt.common.core.resource.java.NestableAnnotationDefinition;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.SecondaryTable
- */
-public final class SecondaryTableAnnotationDefinition
- implements NestableAnnotationDefinition
-{
- // singleton
- private static final NestableAnnotationDefinition INSTANCE = new SecondaryTableAnnotationDefinition();
-
- /**
- * Return the singleton.
- */
- public static NestableAnnotationDefinition instance() {
- return INSTANCE;
- }
-
- /**
- * Ensure single instance.
- */
- private SecondaryTableAnnotationDefinition() {
- super();
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) {
- return SourceSecondaryTableAnnotation.buildSourceSecondaryTableAnnotation(parent, annotatedElement, index);
- }
-
- public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation, int index) {
- return new BinarySecondaryTableAnnotation(parent, jdtAnnotation);
- }
-
- public String getNestableAnnotationName() {
- return JPA.SECONDARY_TABLE;
- }
-
- public String getContainerAnnotationName() {
- return JPA.SECONDARY_TABLES;
- }
-
- public String getElementName() {
- return JPA.SECONDARY_TABLES__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
deleted file mode 100644
index 64e14a199f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryNamedAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceNamedAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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 SourceNamedAnnotation(parent, annotatedElement, getAnnotationName());
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryNamedAnnotation(parent, jdtAnnotation, getAnnotationName());
- }
-
- public String getAnnotationName() {
- return JPA.SECONDARY_TABLES;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
deleted file mode 100644
index 3784a290f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinarySequenceGenerator1_0Annotation;
-import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceSequenceGenerator1_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinarySequenceGenerator1_0Annotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return SequenceGeneratorAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java
deleted file mode 100644
index d189d64a3b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullTableAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryTableAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return TableAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
deleted file mode 100644
index 8cbe2da7f8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTableGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTableGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryTableGeneratorAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return TableGeneratorAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java
deleted file mode 100644
index a69962e8f7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTemporalAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTemporalAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- return new NullTemporalAnnotation(parent);
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryTemporalAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return TemporalAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java
deleted file mode 100644
index 930a13f526..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryTransientAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTransientAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryTransientAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return TransientAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java
deleted file mode 100644
index 3406e69c29..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java
+++ /dev/null
@@ -1,59 +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.jpa.core.internal.resource.java;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.Annotation;
-import org.eclipse.jpt.common.core.resource.java.AnnotationDefinition;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryVersionAnnotation;
-import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceVersionAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.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(parent, annotatedElement);
- }
-
- public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) {
- throw new UnsupportedOperationException();
- }
-
- public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- return new BinaryVersionAnnotation(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return VersionAnnotation.ANNOTATION_NAME;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
deleted file mode 100644
index e148d63290..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java
+++ /dev/null
@@ -1,96 +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.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-
-/**
- * javax.persistence.AssociationOverride
- */
-public abstract class BinaryAssociationOverrideAnnotation
- extends BinaryOverrideAnnotation
- implements AssociationOverrideAnnotation
-{
- 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 ListIterable<JoinColumnAnnotation> getJoinColumns() {
- return new LiveCloneListIterable<JoinColumnAnnotation>(this.joinColumns);
- }
-
- public int getJoinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<JoinColumnAnnotation> buildJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS);
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- // TODO
- private void updateJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
deleted file mode 100644
index d5c6a4f44d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java
+++ /dev/null
@@ -1,111 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.AttributeOverride
- */
-public final class BinaryAttributeOverrideAnnotation
- extends BinaryOverrideAnnotation
- implements AttributeOverrideAnnotation
-{
- private ColumnAnnotation column;
- private final ColumnAnnotation nullColumn;
-
-
- public BinaryAttributeOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.column = this.buildColumn();
- this.nullColumn = this.buildNullColumn();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateColumn();
- }
-
-
- //************ BinaryOverrideAnnotation implementation ****************
-
- @Override
- protected String getNameElementName() {
- return JPA.ATTRIBUTE_OVERRIDE__NAME;
- }
-
-
- //************ AttributeOverride implementation ****************
-
- // ***** column
- public ColumnAnnotation getColumn() {
- return this.column;
- }
-
- public ColumnAnnotation getNonNullColumn() {
- return (this.column != null) ? this.column : this.nullColumn;
- }
-
- public ColumnAnnotation addColumn() {
- throw new UnsupportedOperationException();
- }
-
- public void removeColumn() {
- throw new UnsupportedOperationException();
- }
-
- private ColumnAnnotation buildColumn() {
- IAnnotation jdtColumn = this.getJdtColumn();
- return (jdtColumn == null) ? null : this.buildColumn(jdtColumn);
- }
-
- private ColumnAnnotation buildNullColumn() {
- return new NullAttributeOverrideColumnAnnotation(this);
- }
-
- private ColumnAnnotation buildColumn(IAnnotation jdtColumn) {
- return new BinaryColumnAnnotation(this, jdtColumn);
- }
-
- private IAnnotation getJdtColumn() {
- return (IAnnotation) this.getJdtMemberValue(JPA.ATTRIBUTE_OVERRIDE__COLUMN);
- }
-
- private void setColumn(ColumnAnnotation column) {
- ColumnAnnotation old = this.column;
- this.column = column;
- this.firePropertyChanged(COLUMN_PROPERTY, old, column);
- }
-
- // TODO
- private void updateColumn() {
- throw new UnsupportedOperationException();
-// IAnnotation jdtColumn = this.getJdtColumn();
-// if (jdtColumn == null) {
-// this.setColumn(null);
-// } else {
-// if (this.column == null) {
-// this.setColumn(this.buildColumn(jdtColumn));
-// } else {
-// this.column.update(jdtColumn);
-// }
-// }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
deleted file mode 100644
index db7ee3fbec..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java
+++ /dev/null
@@ -1,184 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation;
-
-/**
- * javax.persistence.Column
- * javax.persistence.JoinColumn
- */
-public abstract class BinaryBaseColumnAnnotation
- extends BinaryNamedColumnAnnotation
- implements BaseColumnAnnotation
-{
- private String table;
- private Boolean unique;
- private Boolean nullable;
- private Boolean insertable;
- private Boolean updatable;
-
-
- protected BinaryBaseColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.table = this.buildTable();
- this.unique = this.buildUnique();
- this.nullable = this.buildNullable();
- this.insertable = this.buildInsertable();
- this.updatable = this.buildUpdatable();
- }
-
- @Override
- public void update() {
- super.update();
- this.setTable_(this.buildTable());
- this.setUnique_(this.buildUnique());
- this.setNullable_(this.buildNullable());
- this.setInsertable_(this.buildInsertable());
- this.setUpdatable_(this.buildUpdatable());
- }
-
-
- //************* BaseColumnAnnotation implementation *************
-
- // ***** table
- public String getTable() {
- return this.table;
- }
-
- public void setTable(String table) {
- throw new UnsupportedOperationException();
- }
-
- private void setTable_(String table) {
- String old = this.table;
- this.table = table;
- this.firePropertyChanged(TABLE_PROPERTY, old, table);
- }
-
- private String buildTable() {
- return (String) this.getJdtMemberValue(this.getTableElementName());
- }
-
- protected abstract String getTableElementName();
-
- public TextRange getTableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean tableTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** unique
- public Boolean getUnique() {
- return this.unique;
- }
-
- public void setUnique(Boolean unique) {
- throw new UnsupportedOperationException();
- }
-
- private void setUnique_(Boolean unique) {
- Boolean old = this.unique;
- this.unique = unique;
- this.firePropertyChanged(UNIQUE_PROPERTY, old, unique);
- }
-
- private Boolean buildUnique() {
- return (Boolean) this.getJdtMemberValue(this.getUniqueElementName());
- }
-
- protected abstract String getUniqueElementName();
-
- public TextRange getUniqueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** nullable
- public Boolean getNullable() {
- return this.nullable;
- }
-
- public void setNullable(Boolean nullable) {
- throw new UnsupportedOperationException();
- }
-
- private void setNullable_(Boolean nullable) {
- Boolean old = this.nullable;
- this.nullable = nullable;
- this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable);
- }
-
- private Boolean buildNullable() {
- return (Boolean) this.getJdtMemberValue(this.getNullableElementName());
- }
-
- protected abstract String getNullableElementName();
-
- public TextRange getNullableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** insertable
- public Boolean getInsertable() {
- return this.insertable;
- }
-
- public void setInsertable(Boolean insertable) {
- throw new UnsupportedOperationException();
- }
-
- private void setInsertable_(Boolean insertable) {
- Boolean old = this.insertable;
- this.insertable = insertable;
- this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable);
- }
-
- private Boolean buildInsertable() {
- return (Boolean) this.getJdtMemberValue(this.getInsertableElementName());
- }
-
- protected abstract String getInsertableElementName();
-
- public TextRange getInsertableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** updatable
- public Boolean getUpdatable() {
- return this.updatable;
- }
-
- public void setUpdatable(Boolean updatable) {
- throw new UnsupportedOperationException();
- }
-
- private void setUpdatable_(Boolean updatable) {
- Boolean old = this.updatable;
- this.updatable = updatable;
- this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable);
- }
-
- private Boolean buildUpdatable() {
- return (Boolean) this.getJdtMemberValue(this.getUpdatableElementName());
- }
-
- protected abstract String getUpdatableElementName();
-
- public TextRange getUpdatableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseDiscriminatorColumnAnnotation.java
deleted file mode 100644
index 5ad8acee12..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,83 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
-
-public abstract class BinaryBaseDiscriminatorColumnAnnotation
- extends BinaryNamedColumnAnnotation
- implements DiscriminatorColumnAnnotation
-{
- private DiscriminatorType discriminatorType;
- private Integer length;
-
-
- protected BinaryBaseDiscriminatorColumnAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.discriminatorType = this.buildDiscriminatorType();
- this.length = this.buildLength();
- }
-
- @Override
- public void update() {
- super.update();
- this.setDiscriminatorType_(this.buildDiscriminatorType());
- this.setLength_(this.buildLength());
- }
-
-
- // ********** 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(this.getDiscriminatorTypeElementName()));
- }
-
- protected abstract String getDiscriminatorTypeElementName();
-
- // ***** 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(this.getLengthElementName());
- }
-
- protected abstract String getLengthElementName();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
deleted file mode 100644
index 87abdef48c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java
+++ /dev/null
@@ -1,69 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.EnumType;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-
-/**
- * javax.persistence.Enumerated
- */
-public abstract class BinaryBaseEnumeratedAnnotation
- extends BinaryAnnotation
- implements EnumeratedAnnotation
-{
- private EnumType value;
-
-
- protected BinaryBaseEnumeratedAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** EnumeratedAnnotation implementation **********
-
- // ***** value
- public EnumType getValue() {
- return this.value;
- }
-
- public void setValue(EnumType value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(EnumType value) {
- EnumType old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private EnumType buildValue() {
- return EnumType.fromJavaAnnotationValue(this.getJdtMemberValue(this.getValueElementName()));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- protected abstract String getValueElementName();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
deleted file mode 100644
index 6c4e7b5a21..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java
+++ /dev/null
@@ -1,73 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.BaseJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.JoinColumn
- * javax.persistence.MapKeyJoinColumn
- */
-public abstract class BinaryBaseJoinColumnAnnotation
- extends BinaryBaseColumnAnnotation
- implements BaseJoinColumnAnnotation
-{
- private String referencedColumnName;
-
-
- public BinaryBaseJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.referencedColumnName = this.buildReferencedColumnName();
- }
-
- @Override
- public void update() {
- super.update();
- this.setReferencedColumnName_(this.buildReferencedColumnName());
- }
-
- protected abstract String getReferencedColumnNameElementName();
-
-
- //************ BaseJoinColumnAnnotation implementation ***************
-
- // referenced column name
- public String getReferencedColumnName() {
- return this.referencedColumnName;
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- throw new UnsupportedOperationException();
- }
-
- private void setReferencedColumnName_(String referencedColumnName) {
- String old = this.referencedColumnName;
- this.referencedColumnName = referencedColumnName;
- this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName);
- }
-
- private String buildReferencedColumnName() {
- return (String) this.getJdtMemberValue(JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java
deleted file mode 100644
index fb2329bf27..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.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.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-
-/**
- * javax.persistence.Table
- * javax.persistence.JoinTable
- * javax.persistence.SecondaryTable
- */
-public abstract class BinaryBaseTableAnnotation
- extends BinaryAnnotation
- implements BaseTableAnnotation
-{
- String name;
- String schema;
- String catalog;
- final Vector<UniqueConstraintAnnotation> uniqueConstraints;
-
-
- protected BinaryBaseTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.schema = this.buildSchema();
- this.catalog = this.buildCatalog();
- this.uniqueConstraints = this.buildUniqueConstraints();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setSchema_(this.buildSchema());
- this.setCatalog_(this.buildCatalog());
- this.updateUniqueConstraints();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** BaseTableAnnotation implementation **********
-
- public boolean isSpecified() {
- return true;
- }
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- protected abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** schema
- public String getSchema() {
- return this.schema;
- }
-
- public void setSchema(String schema) {
- throw new UnsupportedOperationException();
- }
-
- private void setSchema_(String schema) {
- String old = this.schema;
- this.schema = schema;
- this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
- }
-
- private String buildSchema() {
- return (String) this.getJdtMemberValue(this.getSchemaElementName());
- }
-
- protected abstract String getSchemaElementName();
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** catalog
- public String getCatalog() {
- return this.catalog;
- }
-
- public void setCatalog(String catalog) {
- throw new UnsupportedOperationException();
- }
-
- private void setCatalog_(String catalog) {
- String old = this.catalog;
- this.catalog = catalog;
- this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
- }
-
- private String buildCatalog() {
- return (String) this.getJdtMemberValue(this.getCatalogElementName());
- }
-
- protected abstract String getCatalogElementName();
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** unique constraints
-
- public ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
- return new LiveCloneListIterable<UniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraints.get(index);
- }
-
- public UniqueConstraintAnnotation addUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<UniqueConstraintAnnotation> buildUniqueConstraints() {
- Object[] jdtUniqueConstraints = this.getJdtMemberValues(this.getUniqueConstraintElementName());
- Vector<UniqueConstraintAnnotation> result = new Vector<UniqueConstraintAnnotation>(jdtUniqueConstraints.length);
- for (Object jdtUniqueConstraint : jdtUniqueConstraints) {
- result.add(new BinaryUniqueConstraintAnnotation(this, (IAnnotation) jdtUniqueConstraint));
- }
- return result;
- }
-
- protected abstract String getUniqueConstraintElementName();
-
- // TODO
- private void updateUniqueConstraints() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
deleted file mode 100644
index 604bffa2f6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java
+++ /dev/null
@@ -1,69 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
-
-/**
- * javax.persistence.Temporal
- * javax.persistence.MapKeyTemporal
- */
-public abstract class BinaryBaseTemporalAnnotation
- extends BinaryAnnotation
- implements TemporalAnnotation
-{
- private TemporalType value;
-
-
- protected BinaryBaseTemporalAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** TemporalAnnotation implementation **********
-
- // ***** value
- public TemporalType getValue() {
- return this.value;
- }
-
- public void setValue(TemporalType value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(TemporalType value) {
- TemporalType old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private TemporalType buildValue() {
- return TemporalType.fromJavaAnnotationValue(this.getJdtMemberValue(getValueElementName()));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- protected abstract String getValueElementName();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java
deleted file mode 100644
index bab7a35295..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java
+++ /dev/null
@@ -1,98 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Basic
- */
-public final class BinaryBasicAnnotation
- extends BinaryAnnotation
- implements BasicAnnotation
-{
- private Boolean optional;
- private FetchType fetch;
-
-
- public BinaryBasicAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.optional = this.buildOptional();
- this.fetch = this.buildFetch();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setOptional_(this.buildOptional());
- this.setFetch_(this.buildFetch());
- }
-
-
- //*************** Basic implementation ****************
-
- // ***** optional
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean optional) {
- throw new UnsupportedOperationException();
- }
-
- private void setOptional_(Boolean optional) {
- Boolean old = this.optional;
- this.optional = optional;
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
- }
-
- private Boolean buildOptional() {
- return (Boolean) this.getJdtMemberValue(JPA.BASIC__OPTIONAL);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- throw new UnsupportedOperationException();
- }
-
- private void setFetch_(FetchType fetch) {
- FetchType old = this.fetch;
- this.fetch = fetch;
- this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
- }
-
- private FetchType buildFetch() {
- return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.BASIC__FETCH));
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java
deleted file mode 100644
index 60434795da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java
+++ /dev/null
@@ -1,91 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Column
- */
-public final class BinaryColumnAnnotation
- extends BinaryCompleteColumnAnnotation
- implements ColumnAnnotation
-{
-
- public BinaryColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** BinaryNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** BinaryBaseColumnAnnotation implementation **********
-
- @Override
- protected String getTableElementName() {
- return JPA.COLUMN__TABLE;
- }
-
- @Override
- protected String getUniqueElementName() {
- return JPA.COLUMN__UNIQUE;
- }
-
- @Override
- protected String getNullableElementName() {
- return JPA.COLUMN__NULLABLE;
- }
-
- @Override
- protected String getInsertableElementName() {
- return JPA.COLUMN__INSERTABLE;
- }
-
- @Override
- protected String getUpdatableElementName() {
- return JPA.COLUMN__UPDATABLE;
- }
-
-
- // ********** BinaryCompleteColumnAnnotation implementation **********
-
- @Override
- protected String getLengthElementName() {
- return JPA.COLUMN__LENGTH;
- }
-
- @Override
- protected String getPrecisionElementName() {
- return JPA.COLUMN__PRECISION;
- }
-
- @Override
- protected String getScaleElementName() {
- return JPA.COLUMN__SCALE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
deleted file mode 100644
index 4bd844d4bd..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java
+++ /dev/null
@@ -1,124 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
-
-/**
- * Abstract implementation of ColumnAnnotation to be used for JPA annotations:
- * javax.persistence.Column
- * javax.persistence.MapKeyColumn
- */
-public abstract class BinaryCompleteColumnAnnotation
- extends BinaryBaseColumnAnnotation
- implements CompleteColumnAnnotation
-{
- protected Integer length;
- protected Integer precision;
- protected Integer scale;
-
-
- protected BinaryCompleteColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.length = this.buildLength();
- this.precision = this.buildPrecision();
- this.scale = this.buildScale();
- }
-
- @Override
- public void update() {
- super.update();
- this.setLength_(this.buildLength());
- this.setPrecision_(this.buildPrecision());
- this.setScale_(this.buildScale());
- }
-
-
- // ********** ColumnAnnotation implementation **********
-
- // ***** length
- public Integer getLength() {
- return this.length;
- }
-
- public void setLength(Integer length) {
- throw new UnsupportedOperationException();
- }
-
- private void setLength_(Integer length) {
- Integer old = this.length;
- this.length = length;
- this.firePropertyChanged(LENGTH_PROPERTY, old, length);
- }
-
- private Integer buildLength() {
- return (Integer) this.getJdtMemberValue(this.getLengthElementName());
- }
-
- public TextRange getLengthTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- protected abstract String getLengthElementName();
-
- // ***** precision
- public Integer getPrecision() {
- return this.precision;
- }
-
- public void setPrecision(Integer precision) {
- throw new UnsupportedOperationException();
- }
-
- private void setPrecision_(Integer precision) {
- Integer old = this.precision;
- this.precision = precision;
- this.firePropertyChanged(PRECISION_PROPERTY, old, precision);
- }
-
- private Integer buildPrecision() {
- return (Integer) this.getJdtMemberValue(this.getPrecisionElementName());
- }
-
- public TextRange getPrecisionTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- protected abstract String getPrecisionElementName();
-
- // ***** scale
- public Integer getScale() {
- return this.scale;
- }
-
- public void setScale(Integer scale) {
- throw new UnsupportedOperationException();
- }
-
- private void setScale_(Integer scale) {
- Integer old = this.scale;
- this.scale = scale;
- this.firePropertyChanged(SCALE_PROPERTY, old, scale);
- }
-
- private Integer buildScale() {
- return (Integer) this.getJdtMemberValue(this.getScaleElementName());
- }
-
- public TextRange getScaleTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- protected abstract String getScaleElementName();
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
deleted file mode 100644
index 6ffea3f24e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,55 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.DiscriminatorColumn
- */
-public final class BinaryDiscriminatorColumnAnnotation
- extends BinaryBaseDiscriminatorColumnAnnotation
-{
-
-
- public BinaryDiscriminatorColumnAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ********** BinaryBaseDiscriminatorColumnAnnotation implementation **********
-
- @Override
- protected String getDiscriminatorTypeElementName() {
- return JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE;
- }
-
- @Override
- protected String getLengthElementName() {
- return JPA.DISCRIMINATOR_COLUMN__LENGTH;
- }
-
- // ********** BinaryNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.DISCRIMINATOR_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
deleted file mode 100644
index 6ea557a0e5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java
+++ /dev/null
@@ -1,71 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.DiscriminatorValue
- */
-public final class BinaryDiscriminatorValueAnnotation
- extends BinaryAnnotation
- implements DiscriminatorValueAnnotation
-{
- private String value;
-
-
- public BinaryDiscriminatorValueAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** DiscriminatorValueAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA.DISCRIMINATOR_VALUE__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
deleted file mode 100644
index 8b7f468f68..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java
+++ /dev/null
@@ -1,33 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-
-/**
- * javax.persistence.Embeddable
- */
-public final class BinaryEmbeddableAnnotation
- extends BinaryAnnotation
- implements EmbeddableAnnotation
-{
-
- public BinaryEmbeddableAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
deleted file mode 100644
index 26fee36772..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java
+++ /dev/null
@@ -1,33 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-
-/**
- * javax.persistence.Embedded
- */
-public final class BinaryEmbeddedAnnotation
- extends BinaryAnnotation
- implements EmbeddedAnnotation
-{
-
- public BinaryEmbeddedAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
deleted file mode 100644
index e37c65f6d8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java
+++ /dev/null
@@ -1,33 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
-
-/**
- * javax.persistence.EmbeddedId
- */
-public final class BinaryEmbeddedIdAnnotation
- extends BinaryAnnotation
- implements EmbeddedIdAnnotation
-{
-
- public BinaryEmbeddedIdAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java
deleted file mode 100644
index 6c04b94af6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java
+++ /dev/null
@@ -1,76 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Entity
- */
-public final class BinaryEntityAnnotation
- extends BinaryAnnotation
- implements EntityAnnotation
-{
- private String name;
-
-
- public BinaryEntityAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** EntityAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(JPA.ENTITY__NAME);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
deleted file mode 100644
index 0439e1ad2f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java
+++ /dev/null
@@ -1,37 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Enumerated
- */
-public final class BinaryEnumeratedAnnotation
- extends BinaryBaseEnumeratedAnnotation
- implements EnumeratedAnnotation
-{
-
- public BinaryEnumeratedAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected String getValueElementName() {
- return JPA.ENUMERATED__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java
deleted file mode 100644
index d441b066be..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.GenerationType;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.GeneratedValue
- */
-public final class BinaryGeneratedValueAnnotation
- extends BinaryAnnotation
- implements GeneratedValueAnnotation
-{
- private GenerationType strategy;
- private String generator;
-
-
- public BinaryGeneratedValueAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.strategy = this.buildStrategy();
- this.generator = this.buildGenerator();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setStrategy_(this.buildStrategy());
- this.setGenerator_(this.buildGenerator());
- }
-
-
- // ********** GeneratedValueAnnotation implementation **********
-
- // ***** strategy
- public GenerationType getStrategy() {
- return this.strategy;
- }
-
- public void setStrategy(GenerationType strategy) {
- throw new UnsupportedOperationException();
- }
-
- private void setStrategy_(GenerationType strategy) {
- GenerationType old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- private GenerationType buildStrategy() {
- return GenerationType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.GENERATED_VALUE__STRATEGY));
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** generator
- public String getGenerator() {
- return this.generator;
- }
-
- public void setGenerator(String generator) {
- throw new UnsupportedOperationException();
- }
-
- private void setGenerator_(String generator) {
- String old = this.generator;
- this.generator = generator;
- this.firePropertyChanged(GENERATOR_PROPERTY, old, generator);
- }
-
- private String buildGenerator() {
- return (String) this.getJdtMemberValue(JPA.GENERATED_VALUE__GENERATOR);
- }
-
- public TextRange getGeneratorTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean generatorTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
deleted file mode 100644
index e03025b43d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java
+++ /dev/null
@@ -1,130 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
-
-/**
- * javax.persistence.SequenceGenerator
- * javax.persistence.TableGenerator
- */
-abstract class BinaryGeneratorAnnotation
- extends BinaryAnnotation
- implements GeneratorAnnotation
-{
- String name;
- Integer initialValue;
- Integer allocationSize;
-
-
- BinaryGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.initialValue = this.buildInitialValue();
- this.allocationSize = this.buildAllocationSize();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setInitialValue_(this.buildInitialValue());
- this.setAllocationSize_(this.buildAllocationSize());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** GeneratorAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** initial value
- public Integer getInitialValue() {
- return this.initialValue;
- }
-
- public void setInitialValue(Integer initialValue) {
- throw new UnsupportedOperationException();
- }
-
- private void setInitialValue_(Integer initialValue) {
- Integer old = this.initialValue;
- this.initialValue = initialValue;
- this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, initialValue);
- }
-
- private Integer buildInitialValue() {
- return (Integer) this.getJdtMemberValue(this.getInitialValueElementName());
- }
-
- abstract String getInitialValueElementName();
-
- public TextRange getInitialValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** name
- public Integer getAllocationSize() {
- return this.allocationSize;
- }
-
- public void setAllocationSize(Integer allocationSize) {
- throw new UnsupportedOperationException();
- }
-
- private void setAllocationSize_(Integer allocationSize) {
- Integer old = this.allocationSize;
- this.allocationSize = allocationSize;
- this.firePropertyChanged(NAME_PROPERTY, old, allocationSize);
- }
-
- private Integer buildAllocationSize() {
- return (Integer) this.getJdtMemberValue(this.getAllocationSizeElementName());
- }
-
- abstract String getAllocationSizeElementName();
-
- public TextRange getAllocationSizeTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java
deleted file mode 100644
index 61294a3af4..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java
+++ /dev/null
@@ -1,33 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-
-/**
- * javax.persistence.Id
- */
-public final class BinaryIdAnnotation
- extends BinaryAnnotation
- implements IdAnnotation
-{
-
- public BinaryIdAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
deleted file mode 100644
index b574a69716..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java
+++ /dev/null
@@ -1,79 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.IdClass
- */
-public final class BinaryIdClassAnnotation
- extends BinaryAnnotation
- implements IdClassAnnotation
-{
- private String value;
-
-
- public BinaryIdClassAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
-
- // ********** IdClassAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA.ID_CLASS__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fully-qualified class name
- /**
- * binary is already fully-qualified
- */
- public String getFullyQualifiedClassName() {
- return this.value;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
deleted file mode 100644
index ac209388da..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java
+++ /dev/null
@@ -1,72 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Inheritance
- */
-public final class BinaryInheritanceAnnotation
- extends BinaryAnnotation
- implements InheritanceAnnotation
-{
- private InheritanceType strategy;
-
-
- public BinaryInheritanceAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.strategy = this.buildStrategy();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setStrategy_(this.buildStrategy());
- }
-
-
- // ********** InheritanceAnnotation implementation **********
-
- // ***** strategy
- public InheritanceType getStrategy() {
- return this.strategy;
- }
-
- public void setStrategy(InheritanceType strategy) {
- throw new UnsupportedOperationException();
- }
-
- private void setStrategy_(InheritanceType strategy) {
- InheritanceType old = this.strategy;
- this.strategy = strategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy);
- }
-
- private InheritanceType buildStrategy() {
- return InheritanceType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA.INHERITANCE__STRATEGY));
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
deleted file mode 100644
index 8bafa27240..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java
+++ /dev/null
@@ -1,82 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-
-/**
- * javax.persistence.JoinColumn
- */
-public final class BinaryJoinColumnAnnotation
- extends BinaryBaseJoinColumnAnnotation
- implements JoinColumnAnnotation
-{
-
- public BinaryJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** BinaryNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.JOIN_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.JOIN_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** BinaryBaseColumnAnnotation implementation **********
-
- @Override
- protected String getTableElementName() {
- return JPA.JOIN_COLUMN__TABLE;
- }
-
- @Override
- protected String getUniqueElementName() {
- return JPA.JOIN_COLUMN__UNIQUE;
- }
-
- @Override
- protected String getNullableElementName() {
- return JPA.JOIN_COLUMN__NULLABLE;
- }
-
- @Override
- protected String getInsertableElementName() {
- return JPA.JOIN_COLUMN__INSERTABLE;
- }
-
- @Override
- protected String getUpdatableElementName() {
- return JPA.JOIN_COLUMN__UPDATABLE;
- }
-
-
- // ********** BinaryBaseJoinColumnAnnotation implementation **********
-
- @Override
- protected String getReferencedColumnNameElementName() {
- return JPA.JOIN_COLUMN__REFERENCED_COLUMN_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
deleted file mode 100644
index 1ce1051898..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java
+++ /dev/null
@@ -1,154 +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.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-
-/**
- * javax.persistence.JoinTable
- */
-public final class BinaryJoinTableAnnotation
- extends BinaryBaseTableAnnotation
- implements JoinTableAnnotation
-{
- private final Vector<JoinColumnAnnotation> joinColumns;
- private final Vector<JoinColumnAnnotation> inverseJoinColumns;
-
-
- public BinaryJoinTableAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.joinColumns = this.buildJoinColumns();
- this.inverseJoinColumns = this.buildInverseJoinColumns();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateJoinColumns();
- this.updateInverseJoinColumns();
- }
-
-
- // ********** BinaryBaseTableAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.JOIN_TABLE__NAME;
- }
-
- @Override
- protected String getSchemaElementName() {
- return JPA.JOIN_TABLE__SCHEMA;
- }
-
- @Override
- protected String getCatalogElementName() {
- return JPA.JOIN_TABLE__CATALOG;
- }
-
- @Override
- protected String getUniqueConstraintElementName() {
- return JPA.JOIN_TABLE__UNIQUE_CONSTRAINTS;
- }
-
-
- // ********** JoinTableAnnotation implementation **********
-
- // ***** join columns
- public ListIterable<JoinColumnAnnotation> getJoinColumns() {
- return new LiveCloneListIterable<JoinColumnAnnotation>(this.joinColumns);
- }
-
- public int getJoinColumnsSize() {
- return this.joinColumns.size();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumns.get(index);
- }
-
- 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 ListIterable<JoinColumnAnnotation> getInverseJoinColumns() {
- return new LiveCloneListIterable<JoinColumnAnnotation>(this.inverseJoinColumns);
- }
-
- public int getInverseJoinColumnsSize() {
- return this.inverseJoinColumns.size();
- }
-
- public JoinColumnAnnotation inverseJoinColumnAt(int index) {
- return this.inverseJoinColumns.get(index);
- }
-
- public JoinColumnAnnotation addInverseJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeInverseJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<JoinColumnAnnotation> buildInverseJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS);
- Vector<JoinColumnAnnotation> result = new Vector<JoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- // TODO
- private void updateInverseJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java
deleted file mode 100644
index 1a76ccda72..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java
+++ /dev/null
@@ -1,32 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
-
-/**
- * javax.persistence.Lob
- */
-public final class BinaryLobAnnotation
- extends BinaryAnnotation
- implements LobAnnotation
-{
- public BinaryLobAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
deleted file mode 100644
index 4ddce31bf8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java
+++ /dev/null
@@ -1,92 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToMany2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.ManyToMany
- */
-public final class BinaryManyToManyAnnotation
- extends BinaryRelationshipMappingAnnotation
- implements ManyToMany2_0Annotation
-{
- private String mappedBy;
-
-
- public BinaryManyToManyAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.mappedBy = this.buildMappedBy();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setMappedBy_(this.buildMappedBy());
- }
-
-
- // ********** BinaryRelationshipMappingAnnotation implementation **********
-
- @Override
- String getTargetEntityElementName() {
- return JPA.MANY_TO_MANY__TARGET_ENTITY;
- }
-
- @Override
- String getFetchElementName() {
- return JPA.MANY_TO_MANY__FETCH;
- }
-
- @Override
- String getCascadeElementName() {
- return JPA.MANY_TO_MANY__CASCADE;
- }
-
-
- //**************** OwnableRelationshipMappingAnnotation implementation **************
-
- // ***** mapped by
- public String getMappedBy() {
- return this.mappedBy;
- }
-
- public void setMappedBy(String mappedBy) {
- throw new UnsupportedOperationException();
- }
-
- private void setMappedBy_(String mappedBy) {
- String old = this.mappedBy;
- this.mappedBy = mappedBy;
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
- }
-
- private String buildMappedBy() {
- return (String) this.getJdtMemberValue(JPA.MANY_TO_MANY__MAPPED_BY);
- }
-
- public TextRange getMappedByTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
deleted file mode 100644
index 22354e7e5d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java
+++ /dev/null
@@ -1,88 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToOne2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.ManyToOne
- */
-public final class BinaryManyToOneAnnotation
- extends BinaryRelationshipMappingAnnotation
- implements ManyToOne2_0Annotation
-{
- private Boolean optional;
-
-
- public BinaryManyToOneAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.optional = this.buildOptional();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setOptional_(this.buildOptional());
- }
-
-
- // ********** BinaryRelationshipMappingAnnotation implementation **********
-
- @Override
- String getTargetEntityElementName() {
- return JPA.MANY_TO_ONE__TARGET_ENTITY;
- }
-
- @Override
- String getFetchElementName() {
- return JPA.MANY_TO_ONE__FETCH;
- }
-
- @Override
- String getCascadeElementName() {
- return JPA.MANY_TO_ONE__CASCADE;
- }
-
-
- // ********** ManyToOneMappingAnnotation implementation **********
-
- // ***** optional
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean optional) {
- throw new UnsupportedOperationException();
- }
-
- private void setOptional_(Boolean optional) {
- Boolean old = this.optional;
- this.optional = optional;
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
- }
-
- private Boolean buildOptional() {
- return (Boolean) this.getJdtMemberValue(JPA.MANY_TO_ONE__OPTIONAL);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
deleted file mode 100644
index f6a6365d9d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java
+++ /dev/null
@@ -1,80 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
-
-/**
- * javax.persistence.MapKey
- */
-public final class BinaryMapKeyAnnotation
- extends BinaryAnnotation
- implements MapKeyAnnotation
-{
- private String name;
-
-
- public BinaryMapKeyAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** MapKeyAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(JPA.MAP_KEY__NAME);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
deleted file mode 100644
index 9f23315f7e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java
+++ /dev/null
@@ -1,29 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
-
-public final class BinaryMappedSuperclassAnnotation
- extends BinaryAnnotation
- implements MappedSuperclassAnnotation
-{
- public BinaryMappedSuperclassAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
deleted file mode 100644
index 3ccea81a5a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java
+++ /dev/null
@@ -1,112 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation;
-
-/**
- * javax.persistence.Column
- * javax.persistence.JoinColumn
- * javax.persistence.DiscriminatorColumn
- * javax.persistence.PrimaryKeyJoinColumn.
- */
-public abstract class BinaryNamedColumnAnnotation
- extends BinaryAnnotation
- implements NamedColumnAnnotation
-{
- private String name;
- private String columnDefinition;
-
-
- protected BinaryNamedColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.columnDefinition = this.buildColumnDefinition();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setColumnDefinition_(this.buildColumnDefinition());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** NamedColumn implementation **********
-
- public boolean isSpecified() {
- return true;
- }
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- protected abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** column definition
- public String getColumnDefinition() {
- return null;
- }
-
- public void setColumnDefinition(String columnDefinition) {
- throw new UnsupportedOperationException();
- }
-
- private void setColumnDefinition_(String columnDefinition) {
- String old = this.columnDefinition;
- this.columnDefinition = columnDefinition;
- this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition);
- }
-
- private String buildColumnDefinition() {
- return (String) this.getJdtMemberValue(this.getColumnDefinitionElementName());
- }
-
- protected abstract String getColumnDefinitionElementName();
-
- public TextRange getColumnDefinitionTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
deleted file mode 100644
index f815dc0b8e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java
+++ /dev/null
@@ -1,119 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-
-/**
- * javax.persistence.NamedNativeQuery
- */
-public final class BinaryNamedNativeQueryAnnotation
- extends BinaryQueryAnnotation
- implements NamedNativeQueryAnnotation
-{
- private String resultClass;
- private String resultSetMapping;
-
-
- public BinaryNamedNativeQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.resultClass = this.buildResultClass();
- this.resultSetMapping = this.buildResultSetMapping();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setResultClass_(this.buildResultClass());
- this.setResultSetMapping_(this.buildResultSetMapping());
- }
-
-
- // ********** BinaryBaseNamedQueryAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.NAMED_NATIVE_QUERY__NAME;
- }
-
- @Override
- String getQueryElementName() {
- return JPA.NAMED_NATIVE_QUERY__QUERY;
- }
-
- @Override
- String getHintsElementName() {
- return JPA.NAMED_NATIVE_QUERY__HINTS;
- }
-
-
- // ********** NamedNativeQueryAnnotation implementation **********
-
- // ***** result class
- public String getResultClass() {
- return this.resultClass;
- }
-
- public void setResultClass(String resultClass) {
- throw new UnsupportedOperationException();
- }
-
- private void setResultClass_(String resultClass) {
- String old = this.resultClass;
- this.resultClass = resultClass;
- this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass);
- }
-
- private String buildResultClass() {
- return (String) this.getJdtMemberValue(JPA.NAMED_NATIVE_QUERY__RESULT_CLASS);
- }
-
- public TextRange getResultClassTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fully-qualified result class name
- public String getFullyQualifiedResultClassName() {
- return this.resultClass;
- }
-
- // ***** result set mapping
- public String getResultSetMapping() {
- return this.resultSetMapping;
- }
-
- public void setResultSetMapping(String resultSetMapping) {
- throw new UnsupportedOperationException();
- }
-
- private void setResultSetMapping_(String resultSetMapping) {
- String old = this.resultSetMapping;
- this.resultSetMapping = resultSetMapping;
- this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping);
- }
-
- private String buildResultSetMapping() {
- return (String) this.getJdtMemberValue(JPA.NAMED_NATIVE_QUERY__RESULT_CLASS);
- }
-
- public TextRange getResultSetMappingTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
deleted file mode 100644
index 878abcbded..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java
+++ /dev/null
@@ -1,50 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-
-/**
- * javax.persistence.NamedQuery
- */
-public abstract class BinaryNamedQueryAnnotation
- extends BinaryQueryAnnotation
- implements NamedQueryAnnotation
-{
- public BinaryNamedQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** BinaryBaseNamedQueryAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.NAMED_QUERY__NAME;
- }
-
- @Override
- String getQueryElementName() {
- return JPA.NAMED_QUERY__QUERY;
- }
-
- @Override
- String getHintsElementName() {
- return JPA.NAMED_QUERY__HINTS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
deleted file mode 100644
index e01e8b6358..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java
+++ /dev/null
@@ -1,121 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToMany2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.mappedBy = this.buildMappedBy();
- this.orphanRemoval = this.buildOrphanRemoval();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setMappedBy_(this.buildMappedBy());
- this.setOrphanRemoval_(this.buildOrphanRemoval());
- }
-
-
- // ********** BinaryRelationshipMappingAnnotation implementation **********
-
- @Override
- String getTargetEntityElementName() {
- return JPA.ONE_TO_MANY__TARGET_ENTITY;
- }
-
- @Override
- String getFetchElementName() {
- return JPA.ONE_TO_MANY__FETCH;
- }
-
- @Override
- String getCascadeElementName() {
- return JPA.ONE_TO_MANY__CASCADE;
- }
-
-
- //**************** OwnableRelationshipMappingAnnotation implementation **************
-
- // ***** mapped by
- public String getMappedBy() {
- return this.mappedBy;
- }
-
- public void setMappedBy(String mappedBy) {
- throw new UnsupportedOperationException();
- }
-
- private void setMappedBy_(String mappedBy) {
- String old = this.mappedBy;
- this.mappedBy = mappedBy;
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
- }
-
- private String buildMappedBy() {
- return (String) this.getJdtMemberValue(JPA.ONE_TO_MANY__MAPPED_BY);
- }
-
- public TextRange getMappedByTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** OneToMany2_0Annotation implementation **********
-
- public Boolean getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- public void setOrphanRemoval(Boolean orphanRemoval) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- private Boolean buildOrphanRemoval() {
- return (Boolean) this.getJdtMemberValue(JPA2_0.ONE_TO_MANY__ORPHAN_REMOVAL);
- }
-
- private void setOrphanRemoval_(Boolean orphanRemoval) {
- Boolean old = this.orphanRemoval;
- this.orphanRemoval = orphanRemoval;
- this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
deleted file mode 100644
index 8f5ea9c86d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java
+++ /dev/null
@@ -1,148 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToOne2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.optional = this.buildOptional();
- this.mappedBy = this.buildMappedBy();
- this.orphanRemoval = this.buildOrphanRemoval();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setOptional_(this.buildOptional());
- this.setMappedBy_(this.buildMappedBy());
- this.setOrphanRemoval_(this.buildOrphanRemoval());
- }
-
-
- // ********** BinaryRelationshipMappingAnnotation implementation **********
-
- @Override
- String getTargetEntityElementName() {
- return JPA.ONE_TO_ONE__TARGET_ENTITY;
- }
-
- @Override
- String getFetchElementName() {
- return JPA.ONE_TO_ONE__FETCH;
- }
-
- @Override
- String getCascadeElementName() {
- return JPA.ONE_TO_ONE__CASCADE;
- }
-
-
- //**************** OwnableRelationshipMappingAnnotation implementation **************
-
- // ***** mapped by
- public String getMappedBy() {
- return this.mappedBy;
- }
-
- public void setMappedBy(String mappedBy) {
- throw new UnsupportedOperationException();
- }
-
- private void setMappedBy_(String mappedBy) {
- String old = this.mappedBy;
- this.mappedBy = mappedBy;
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, mappedBy);
- }
-
- private String buildMappedBy() {
- return (String) this.getJdtMemberValue(JPA.ONE_TO_ONE__MAPPED_BY);
- }
-
- public TextRange getMappedByTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-
- //**************** OneToOneAnnotation implementation **************
-
- // ***** optional
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean optional) {
- throw new UnsupportedOperationException();
- }
-
- private void setOptional_(Boolean optional) {
- Boolean old = this.optional;
- this.optional = optional;
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, optional);
- }
-
- private Boolean buildOptional() {
- return (Boolean) this.getJdtMemberValue(JPA.ONE_TO_ONE__OPTIONAL);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** OneToOne2_0Annotation implementation **********
-
- public Boolean getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- public void setOrphanRemoval(Boolean orphanRemoval) {
- throw new UnsupportedOperationException();
- }
-
- public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- private Boolean buildOrphanRemoval() {
- return (Boolean) this.getJdtMemberValue(JPA2_0.ONE_TO_ONE__ORPHAN_REMOVAL);
- }
-
- private void setOrphanRemoval_(Boolean orphanRemoval) {
- Boolean old = this.orphanRemoval;
- this.orphanRemoval = orphanRemoval;
- this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
deleted file mode 100644
index 6baa37d375..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java
+++ /dev/null
@@ -1,71 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
-
-/**
- * javax.persistence.OrderBy
- */
-public final class BinaryOrderByAnnotation
- extends BinaryAnnotation
- implements OrderByAnnotation
-{
- private String value;
-
-
- public BinaryOrderByAnnotation(JavaResourceAnnotatedElement parent, IAnnotation annotation) {
- super(parent, annotation);
- this.value = this.buildValue();
- }
-
- @Override
- public void update() {
- super.update();
- this.setValue_(this.buildValue());
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** OrderByAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA.ORDER_BY__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
deleted file mode 100644
index 096800ba09..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java
+++ /dev/null
@@ -1,79 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation;
-
-/**
- * Common behavior for
- * javax.persistence.AttributeOverride
- * javax.persistence.AssociationOverride
- */
-public abstract class BinaryOverrideAnnotation
- extends BinaryAnnotation
- implements OverrideAnnotation
-{
- private String name;
-
-
- public BinaryOverrideAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** OverrideAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(OverrideAnnotation.NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- protected abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index 831e4c3ec2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,87 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-
-/**
- * javax.persistence.PrimaryKeyJoinColumn
- */
-public final class BinaryPrimaryKeyJoinColumnAnnotation
- extends BinaryNamedColumnAnnotation
- implements PrimaryKeyJoinColumnAnnotation
-{
- private String referencedColumnName;
-
-
- public BinaryPrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.referencedColumnName = this.buildReferencedColumnName();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setReferencedColumnName_(this.buildReferencedColumnName());
- }
-
-
- // ********** BinaryNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMN__COLUMN_DEFINITION;
- }
-
-
- // ********** PrimaryKeyJoinColumnAnnotation implementation **********
-
- // ***** referenced column name
- public String getReferencedColumnName() {
- return this.referencedColumnName;
- }
-
- public void setReferencedColumnName(String referencedColumnName) {
- throw new UnsupportedOperationException();
- }
-
- private void setReferencedColumnName_(String referencedColumnName) {
- String old = this.referencedColumnName;
- this.referencedColumnName = referencedColumnName;
- this.firePropertyChanged(REFERENCED_COLUMN_NAME_PROPERTY, old, referencedColumnName);
- }
-
- private String buildReferencedColumnName() {
- return (String) this.getJdtMemberValue(JPA.PRIMARY_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME);
- }
-
- public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java
deleted file mode 100644
index 9f9ce90081..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java
+++ /dev/null
@@ -1,151 +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.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-
-/**
- * javax.persistence.NamedQuery
- * javax.persistence.NamedNativeQuery
- */
-abstract class BinaryQueryAnnotation
- extends BinaryAnnotation
- implements QueryAnnotation
-{
- String name;
- String query;
- final Vector<QueryHintAnnotation> hints;
-
-
- BinaryQueryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.query = this.buildQuery();
- this.hints = this.buildHints();
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setQuery_(this.buildQuery());
- this.updateHints();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** BaseNamedQueryAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(this.getNameElementName());
- }
-
- abstract String getNameElementName();
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** query
- public String getQuery() {
- return this.query;
- }
-
- public void setQuery(String query) {
- throw new UnsupportedOperationException();
- }
-
- private void setQuery_(String query) {
- String old = this.query;
- this.query = query;
- this.firePropertyChanged(QUERY_PROPERTY, old, query);
- }
-
- private String buildQuery() {
- return (String) this.getJdtMemberValue(this.getQueryElementName());
- }
-
- abstract String getQueryElementName();
-
- public TextRange getQueryTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** hints
-
- public ListIterable<QueryHintAnnotation> getHints() {
- return new LiveCloneListIterable<QueryHintAnnotation>(this.hints);
- }
-
- public int getHintsSize() {
- return this.hints.size();
- }
-
- public QueryHintAnnotation hintAt(int index) {
- return this.hints.get(index);
- }
-
- public QueryHintAnnotation addHint(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveHint(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeHint(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<QueryHintAnnotation> buildHints() {
- Object[] jdtHints = this.getJdtMemberValues(this.getHintsElementName());
- Vector<QueryHintAnnotation> result = new Vector<QueryHintAnnotation>(jdtHints.length);
- for (Object jdtHint : jdtHints) {
- result.add(new BinaryQueryHintAnnotation(this, (IAnnotation) jdtHint));
- }
- return result;
- }
-
- abstract String getHintsElementName();
-
- // TODO
- private void updateHints() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java
deleted file mode 100644
index 119f055030..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-
-/**
- * javax.persistence.QueryHint
- */
-class BinaryQueryHintAnnotation
- extends BinaryAnnotation
- implements QueryHintAnnotation
-{
- private String name;
- private String value;
-
-
- BinaryQueryHintAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.name = this.buildName();
- this.value = this.buildValue();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setName_(this.buildName());
- this.setValue_(this.buildValue());
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** QueryHintAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- throw new UnsupportedOperationException();
- }
-
- private void setName_(String name) {
- String old = this.name;
- this.name = name;
- this.firePropertyChanged(NAME_PROPERTY, old, name);
- }
-
- private String buildName() {
- return (String) this.getJdtMemberValue(JPA.QUERY_HINT__NAME);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- throw new UnsupportedOperationException();
- }
-
- private void setValue_(String value) {
- String old = this.value;
- this.value = value;
- this.firePropertyChanged(VALUE_PROPERTY, old, value);
- }
-
- private String buildValue() {
- return (String) this.getJdtMemberValue(JPA.QUERY_HINT__VALUE);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
deleted file mode 100644
index 3c1056ace7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java
+++ /dev/null
@@ -1,233 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.CascadeType;
-import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.targetEntity = this.buildTargetEntity();
- this.fetch = this.buildFetch();
- this.initializeCascadeTypes(this.buildCascadeTypes());
- }
-
- protected void initializeCascadeTypes(CascadeType[] cascadeTypes) {
- this.cascadeAll = ArrayTools.contains(cascadeTypes, CascadeType.ALL);
- this.cascadeMerge = ArrayTools.contains(cascadeTypes, CascadeType.MERGE);
- this.cascadePersist = ArrayTools.contains(cascadeTypes, CascadeType.PERSIST);
- this.cascadeRefresh = ArrayTools.contains(cascadeTypes, CascadeType.REFRESH);
- this.cascadeRemove = ArrayTools.contains(cascadeTypes, CascadeType.REMOVE);
- this.cascadeDetach = ArrayTools.contains(cascadeTypes, CascadeType.DETACH);
- }
-
- @Override
- public void update() {
- super.update();
- this.setTargetEntity_(this.buildTargetEntity());
- this.setFetch_(this.buildFetch());
- this.updateCascadeTypes(this.buildCascadeTypes());
- }
-
- protected void updateCascadeTypes(CascadeType[] cascadeTypes) {
- this.setCascadeAll_(ArrayTools.contains(cascadeTypes, CascadeType.ALL));
- this.setCascadeMerge_(ArrayTools.contains(cascadeTypes, CascadeType.MERGE));
- this.setCascadePersist_(ArrayTools.contains(cascadeTypes, CascadeType.PERSIST));
- this.setCascadeRefresh_(ArrayTools.contains(cascadeTypes, CascadeType.REFRESH));
- this.setCascadeRemove_(ArrayTools.contains(cascadeTypes, CascadeType.REMOVE));
- this.setCascadeDetach_(ArrayTools.contains(cascadeTypes, CascadeType.DETACH));
- }
-
- // ********** RelationshipMappingAnnotation implementation **********
-
- // ***** target entity
- public String getTargetEntity() {
- return this.targetEntity;
- }
-
- public void setTargetEntity(String targetEntity) {
- throw new UnsupportedOperationException();
- }
-
- private void setTargetEntity_(String targetEntity) {
- String old = this.targetEntity;
- this.targetEntity = targetEntity;
- this.firePropertyChanged(TARGET_ENTITY_PROPERTY, old, targetEntity);
- }
-
- private String buildTargetEntity() {
- return (String) this.getJdtMemberValue(this.getTargetEntityElementName());
- }
-
- abstract String getTargetEntityElementName();
-
- public TextRange getTargetEntityTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** fully-qualified target entity class name
- public String getFullyQualifiedTargetEntityClassName() {
- return this.targetEntity;
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- throw new UnsupportedOperationException();
- }
-
- private void setFetch_(FetchType fetch) {
- FetchType old = this.fetch;
- this.fetch = fetch;
- this.firePropertyChanged(FETCH_PROPERTY, old, fetch);
- }
-
- private FetchType buildFetch() {
- return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(this.getFetchElementName()));
- }
-
- abstract String getFetchElementName();
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** cascade
- private CascadeType[] buildCascadeTypes() {
- return CascadeType.fromJavaAnnotationValues(this.getJdtMemberValues(this.getCascadeElementName()));
- }
-
- abstract String getCascadeElementName();
-
- public TextRange getCascadeTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** cascade all
- public boolean isCascadeAll() {
- return this.cascadeAll;
- }
-
- public void setCascadeAll(boolean cascadeAll) {
- throw new UnsupportedOperationException();
- }
-
- private void setCascadeAll_(boolean cascadeAll) {
- boolean old = this.cascadeAll;
- this.cascadeAll = cascadeAll;
- this.firePropertyChanged(CASCADE_ALL_PROPERTY, old, cascadeAll);
- }
-
- // ***** cascade merge
- public boolean isCascadeMerge() {
- return this.cascadeMerge;
- }
-
- public void setCascadeMerge(boolean cascadeMerge) {
- throw new UnsupportedOperationException();
- }
-
- private void setCascadeMerge_(boolean cascadeMerge) {
- boolean old = this.cascadeMerge;
- this.cascadeMerge = cascadeMerge;
- this.firePropertyChanged(CASCADE_MERGE_PROPERTY, old, cascadeMerge);
- }
-
- // ***** cascade persist
- public boolean isCascadePersist() {
- return this.cascadePersist;
- }
-
- public void setCascadePersist(boolean cascadePersist) {
- throw new UnsupportedOperationException();
- }
-
- private void setCascadePersist_(boolean cascadePersist) {
- boolean old = this.cascadePersist;
- this.cascadePersist = cascadePersist;
- this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cascadePersist);
- }
-
- // ***** cascade refresh
- public boolean isCascadeRefresh() {
- return this.cascadeRefresh;
- }
-
- public void setCascadeRefresh(boolean cascadeRefresh) {
- throw new UnsupportedOperationException();
- }
-
- private void setCascadeRefresh_(boolean cascadeRefresh) {
- boolean old = this.cascadeRefresh;
- this.cascadeRefresh = cascadeRefresh;
- this.firePropertyChanged(CASCADE_REFRESH_PROPERTY, old, cascadeRefresh);
- }
-
- // ***** cascade remove
- public boolean isCascadeRemove() {
- return this.cascadeRemove;
- }
-
- public void setCascadeRemove(boolean cascadeRemove) {
- throw new UnsupportedOperationException();
- }
-
- private void setCascadeRemove_(boolean cascadeRemove) {
- boolean old = this.cascadeRemove;
- this.cascadeRemove = cascadeRemove;
- this.firePropertyChanged(CASCADE_REMOVE_PROPERTY, old, cascadeRemove);
- }
-
- // ***** cascade detach - JPA 2.0
- public boolean isCascadeDetach() {
- return this.cascadeDetach;
- }
-
- public void setCascadeDetach(boolean cascadeDetach) {
- throw new UnsupportedOperationException();
- }
-
- private void setCascadeDetach_(boolean cascadeDetach) {
- boolean old = this.cascadeDetach;
- this.cascadeDetach = cascadeDetach;
- this.firePropertyChanged(CASCADE_DETACH_PROPERTY, old, cascadeDetach);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
deleted file mode 100644
index fce7c76e93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java
+++ /dev/null
@@ -1,110 +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.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-
-/**
- * javax.persistence.SecondaryTable
- */
-public final class BinarySecondaryTableAnnotation
- extends BinaryBaseTableAnnotation
- implements SecondaryTableAnnotation
-{
- 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 ListIterable<PrimaryKeyJoinColumnAnnotation> getPkJoinColumns() {
- return new LiveCloneListIterable<PrimaryKeyJoinColumnAnnotation>(this.pkJoinColumns);
- }
-
- public int getPkJoinColumnsSize() {
- return this.pkJoinColumns.size();
- }
-
- public PrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) {
- return this.pkJoinColumns.get(index);
- }
-
- public PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void movePkJoinColumn(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removePkJoinColumn(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<PrimaryKeyJoinColumnAnnotation> buildPkJoinColumns() {
- Object[] jdtJoinColumns = this.getJdtMemberValues(JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS);
- Vector<PrimaryKeyJoinColumnAnnotation> result = new Vector<PrimaryKeyJoinColumnAnnotation>(jdtJoinColumns.length);
- for (Object jdtJoinColumn : jdtJoinColumns) {
- result.add(new BinaryPrimaryKeyJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn));
- }
- return result;
- }
-
- // TODO
- private void updatePkJoinColumns() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
deleted file mode 100644
index 2d382036a6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java
+++ /dev/null
@@ -1,92 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
-
-/**
- * javax.persistence.SequenceGenerator
- */
-public abstract class BinarySequenceGeneratorAnnotation
- extends BinaryGeneratorAnnotation
- implements SequenceGeneratorAnnotation
-{
- private String sequenceName;
-
-
- protected BinarySequenceGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.sequenceName = this.buildSequenceName();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setSequenceName_(this.buildSequenceName());
- }
-
-
- // ********** BinaryGeneratorAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.SEQUENCE_GENERATOR__NAME;
- }
-
- @Override
- String getInitialValueElementName() {
- return JPA.SEQUENCE_GENERATOR__INITIAL_VALUE;
- }
-
- @Override
- String getAllocationSizeElementName() {
- return JPA.SEQUENCE_GENERATOR__ALLOCATION_SIZE;
- }
-
-
- // ********** SequenceGeneratorAnnotation implementation **********
-
- // ***** sequence name
- public String getSequenceName() {
- return this.sequenceName;
- }
-
- public void setSequenceName(String sequenceName) {
- throw new UnsupportedOperationException();
- }
-
- private void setSequenceName_(String sequenceName) {
- String old = this.sequenceName;
- this.sequenceName = sequenceName;
- this.firePropertyChanged(SEQUENCE_NAME_PROPERTY, old, sequenceName);
- }
-
- private String buildSequenceName() {
- return (String) this.getJdtMemberValue(JPA.SEQUENCE_GENERATOR__SEQUENCE_NAME);
- }
-
- public TextRange getSequenceNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java
deleted file mode 100644
index ea667ebc11..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java
+++ /dev/null
@@ -1,55 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
-
-/**
- * javax.persistence.Table
- */
-public final class BinaryTableAnnotation
- extends BinaryBaseTableAnnotation
- implements TableAnnotation
-{
- public BinaryTableAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** BinaryBaseTableAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.TABLE__NAME;
- }
-
- @Override
- protected String getSchemaElementName() {
- return JPA.TABLE__SCHEMA;
- }
-
- @Override
- protected String getCatalogElementName() {
- return JPA.TABLE__CATALOG;
- }
-
- @Override
- protected String getUniqueConstraintElementName() {
- return JPA.TABLE__UNIQUE_CONSTRAINTS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
deleted file mode 100644
index 747e97689f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java
+++ /dev/null
@@ -1,288 +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.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-
-/**
- * javax.persistence.TableGenerator
- */
-public final class BinaryTableGeneratorAnnotation
- extends BinaryGeneratorAnnotation
- implements TableGeneratorAnnotation
-{
- private String table;
- private String schema;
- private String catalog;
- private String pkColumnName;
- private String valueColumnName;
- private String pkColumnValue;
- private final Vector<UniqueConstraintAnnotation> uniqueConstraints;
-
-
- public BinaryTableGeneratorAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.table = this.buildTable();
- this.schema = this.buildSchema();
- this.catalog = this.buildCatalog();
- this.pkColumnName = this.buildPkColumnName();
- this.valueColumnName = this.buildValueColumnName();
- this.pkColumnValue = this.buildPkColumnValue();
- this.uniqueConstraints = this.buildUniqueConstraints();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.setTable_(this.buildTable());
- this.setSchema_(this.buildSchema());
- this.setCatalog_(this.buildCatalog());
- this.setPkColumnName_(this.buildPkColumnName());
- this.setValueColumnName_(this.buildValueColumnName());
- this.setPkColumnValue_(this.buildPkColumnValue());
- this.updateUniqueConstraints();
- }
-
-
- // ********** AbstractGeneratorAnnotation implementation **********
-
- @Override
- String getNameElementName() {
- return JPA.TABLE_GENERATOR__NAME;
- }
-
- @Override
- String getInitialValueElementName() {
- return JPA.TABLE_GENERATOR__INITIAL_VALUE;
- }
-
- @Override
- String getAllocationSizeElementName() {
- return JPA.TABLE_GENERATOR__ALLOCATION_SIZE;
- }
-
-
- // ********** TableGeneratorAnnotation implementation **********
-
- // ***** table
- public String getTable() {
- return this.table;
- }
-
- public void setTable(String table) {
- throw new UnsupportedOperationException();
- }
-
- private void setTable_(String table) {
- String old = this.table;
- this.table = table;
- this.firePropertyChanged(TABLE_PROPERTY, old, table);
- }
-
- private String buildTable() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__TABLE);
- }
-
- public TextRange getTableTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean tableTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** schema
- public String getSchema() {
- return this.schema;
- }
-
- public void setSchema(String schema) {
- throw new UnsupportedOperationException();
- }
-
- private void setSchema_(String schema) {
- String old = this.schema;
- this.schema = schema;
- this.firePropertyChanged(SCHEMA_PROPERTY, old, schema);
- }
-
- private String buildSchema() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__SCHEMA);
- }
-
- public TextRange getSchemaTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean schemaTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** catalog
- public String getCatalog() {
- return this.catalog;
- }
-
- public void setCatalog(String catalog) {
- throw new UnsupportedOperationException();
- }
-
- private void setCatalog_(String catalog) {
- String old = this.catalog;
- this.catalog = catalog;
- this.firePropertyChanged(CATALOG_PROPERTY, old, catalog);
- }
-
- private String buildCatalog() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__CATALOG);
- }
-
- public TextRange getCatalogTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean catalogTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** pk column name
- public String getPkColumnName() {
- return this.pkColumnName;
- }
-
- public void setPkColumnName(String pkColumnName) {
- throw new UnsupportedOperationException();
- }
-
- private void setPkColumnName_(String pkColumnName) {
- String old = this.pkColumnName;
- this.pkColumnName = pkColumnName;
- this.firePropertyChanged(PK_COLUMN_NAME_PROPERTY, old, pkColumnName);
- }
-
- private String buildPkColumnName() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__PK_COLUMN_NAME);
- }
-
- public TextRange getPkColumnNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** value column name
- public String getValueColumnName() {
- return this.valueColumnName;
- }
-
- public void setValueColumnName(String valueColumnName) {
- throw new UnsupportedOperationException();
- }
-
- private void setValueColumnName_(String valueColumnName) {
- String old = this.valueColumnName;
- this.valueColumnName = valueColumnName;
- this.firePropertyChanged(VALUE_COLUMN_NAME_PROPERTY, old, valueColumnName);
- }
-
- private String buildValueColumnName() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME);
- }
-
- public TextRange getValueColumnNameTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** pk column value
- public String getPkColumnValue() {
- return this.pkColumnValue;
- }
-
- public void setPkColumnValue(String pkColumnValue) {
- throw new UnsupportedOperationException();
- }
-
- private void setPkColumnValue_(String pkColumnValue) {
- String old = this.pkColumnValue;
- this.pkColumnValue = pkColumnValue;
- this.firePropertyChanged(PK_COLUMN_VALUE_PROPERTY, old, pkColumnValue);
- }
-
- private String buildPkColumnValue() {
- return (String) this.getJdtMemberValue(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE);
- }
-
- public TextRange getPkColumnValueTextRange(CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public boolean pkColumnValueTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- // ***** unique constraints
- public ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
- return new LiveCloneListIterable<UniqueConstraintAnnotation>(this.uniqueConstraints);
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraints.size();
- }
-
- public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraints.get(index);
- }
-
- public UniqueConstraintAnnotation addUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public void removeUniqueConstraint(int index) {
- throw new UnsupportedOperationException();
- }
-
- private Vector<UniqueConstraintAnnotation> buildUniqueConstraints() {
- Object[] jdtUniqueConstraints = this.getJdtMemberValues(JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS);
- Vector<UniqueConstraintAnnotation> result = new Vector<UniqueConstraintAnnotation>(jdtUniqueConstraints.length);
- for (Object jdtUniqueConstraint : jdtUniqueConstraints) {
- result.add(new BinaryUniqueConstraintAnnotation(this, (IAnnotation) jdtUniqueConstraint));
- }
- return result;
- }
-
- // TODO
- private void updateUniqueConstraints() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
deleted file mode 100644
index 780b2aea62..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java
+++ /dev/null
@@ -1,37 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-
-/**
- * javax.persistence.Temporal
- */
-public final class BinaryTemporalAnnotation
- extends BinaryBaseTemporalAnnotation
- implements TemporalAnnotation
-{
-
- public BinaryTemporalAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected String getValueElementName() {
- return JPA.TEMPORAL__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java
deleted file mode 100644
index c6b06c9ed1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java
+++ /dev/null
@@ -1,33 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
-
-/**
- * javax.persistence.Transient
- */
-public final class BinaryTransientAnnotation
- extends BinaryAnnotation
- implements TransientAnnotation
-{
-
- public BinaryTransientAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
deleted file mode 100644
index 15536e6519..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java
+++ /dev/null
@@ -1,101 +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.jpa.core.internal.resource.java.binary;
-
-import java.util.Vector;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-
-/**
- * javax.persistence.UniqueConstraint
- */
-final class BinaryUniqueConstraintAnnotation
- extends BinaryAnnotation
- implements UniqueConstraintAnnotation
-{
- private final Vector<String> columnNames;
-
-
- BinaryUniqueConstraintAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- this.columnNames = this.buildColumnNames();
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void update() {
- super.update();
- this.updateColumnNames();
- }
-
- // TODO
- private void updateColumnNames() {
- throw new UnsupportedOperationException();
- }
-
-
- // ********** UniqueConstraintAnnotation implementation **********
-
- // ***** column names
- public ListIterable<String> getColumnNames() {
- return new LiveCloneListIterable<String>(this.columnNames);
- }
-
- public int getColumnNamesSize() {
- return this.columnNames.size();
- }
-
- public String columnNameAt(int index) {
- return this.columnNames.elementAt(index);
- }
-
- private Vector<String> buildColumnNames() {
- Object[] jdtColumnNames = this.getJdtMemberValues(JPA.UNIQUE_CONSTRAINT__COLUMN_NAMES);
- Vector<String> result = new Vector<String>(jdtColumnNames.length);
- for (Object jdtColumnName : jdtColumnNames) {
- result.add((String) jdtColumnName);
- }
- return result;
- }
-
- public void addColumnName(String columnName) {
- throw new UnsupportedOperationException();
- }
-
- public void addColumnName(int index, String columnName) {
- throw new UnsupportedOperationException();
- }
-
- public void moveColumnName(int targetIndex, int sourceIndex) {
- throw new UnsupportedOperationException();
- }
-
- public boolean columnNamesTouches(int pos, CompilationUnit astRoot) {
- throw new UnsupportedOperationException();
- }
-
- public void removeColumnName(String columnName) {
- throw new UnsupportedOperationException();
- }
-
- public void removeColumnName(int index) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java
deleted file mode 100644
index df5cea5e93..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java
+++ /dev/null
@@ -1,33 +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.jpa.core.internal.resource.java.binary;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jpt.common.core.internal.resource.java.binary.BinaryAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
-
-/**
- * javax.persistence.Version
- */
-public final class BinaryVersionAnnotation
- extends BinaryAnnotation
- implements VersionAnnotation
-{
-
- public BinaryVersionAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) {
- super(parent, jdtAnnotation);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
deleted file mode 100644
index d7285ac8e7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java
+++ /dev/null
@@ -1,157 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-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.resource.java.JavaResourceNode;
-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.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-
-/**
- * <code>javax.persistence.AssociationOverride</code>
- */
-public abstract class SourceAssociationOverrideAnnotation
- extends SourceOverrideAnnotation
- implements AssociationOverrideAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- public static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ASSOCIATION_OVERRIDES);
-
- private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
-
-
-
- protected SourceAssociationOverrideAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, daa, annotationAdapter);
- }
-
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.joinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.joinColumnsContainer.synchronize(this.getAstAnnotation(astRoot));
- }
-
-
- // ********** SourceOverrideAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.ASSOCIATION_OVERRIDE__NAME;
- }
-
-
- // ********** AssociationOverrideAnnotation implementation **********
-
- // **************** join columns *************************************************
-
- public ListIterable<JoinColumnAnnotation> getJoinColumns() {
- return this.joinColumnsContainer.getNestedAnnotations();
- }
-
- public int getJoinColumnsSize() {
- return this.joinColumnsContainer.getNestedAnnotationsSize();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumnsContainer.nestedAnnotationAt(index);
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- return this.joinColumnsContainer.addNestedAnnotation(index);
- }
-
- private JoinColumnAnnotation buildJoinColumn(int index) {
- return SourceJoinColumnAnnotation.buildNestedSourceJoinColumnAnnotation(
- this, this.annotatedElement, this.buildJoinColumnIndexedDeclarationAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(
- this.daa, JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- this.joinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- }
-
- public void removeJoinColumn(int index) {
- this.joinColumnsContainer.removeNestedAnnotation(index);
- }
-
- /**
- * adapt the AnnotationContainer interface to the association override's join columns
- */
- class JoinColumnsAnnotationContainer
- extends AnnotationContainer<JoinColumnAnnotation>
- {
- @Override
- protected String getAnnotationsPropertyName() {
- return JOIN_COLUMNS_LIST;
- }
- @Override
- protected String getElementName() {
- return JPA.ASSOCIATION_OVERRIDE__JOIN_COLUMNS;
- }
- @Override
- protected String getNestedAnnotationName() {
- return JPA.JOIN_COLUMN;
- }
- @Override
- protected JoinColumnAnnotation buildNestedAnnotation(int index) {
- return SourceAssociationOverrideAnnotation.this.buildJoinColumn(index);
- }
- }
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.joinColumnsContainer.isEmpty();
- }
-
- // ********** static methods **********
-
- protected static IndexedAnnotationAdapter buildAssociationOverrideAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
- return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
- }
-
- protected static IndexedDeclarationAnnotationAdapter buildAssociationOverrideDeclarationAnnotationAdapter(int index) {
- IndexedDeclarationAnnotationAdapter idaa =
- new CombinationIndexedDeclarationAnnotationAdapter(
- DECLARATION_ANNOTATION_ADAPTER,
- CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
- index,
- ANNOTATION_NAME);
- return idaa;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
deleted file mode 100644
index 4b90c84ed5..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java
+++ /dev/null
@@ -1,204 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-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.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.internal.resource.java.NullAttributeOverrideColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * <code>javax.persistence.AttributeOverride</code>
- */
-public final class SourceAttributeOverrideAnnotation
- extends SourceOverrideAnnotation
- implements AttributeOverrideAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.ATTRIBUTE_OVERRIDES);
-
- private ElementAnnotationAdapter columnAdapter;
- private ColumnAnnotation column;
- private final ColumnAnnotation nullColumn;
-
-
- public static SourceAttributeOverrideAnnotation buildSourceAttributeOverrideAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element) {
-
- return new SourceAttributeOverrideAnnotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public static SourceAttributeOverrideAnnotation buildSourceAttributeOverrideAnnotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement annotatedElement,
- int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildAttributeOverrideDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildAttributeOverrideAnnotationAdapter(annotatedElement, idaa);
- return new SourceAttributeOverrideAnnotation(
- parent,
- annotatedElement,
- idaa,
- iaa);
- }
-
- public static SourceAttributeOverrideAnnotation buildNestedSourceAttributeOverrideAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- return new SourceAttributeOverrideAnnotation(parent, element, idaa);
- }
-
- private SourceAttributeOverrideAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- DeclarationAnnotationAdapter daa) {
-
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- private SourceAttributeOverrideAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
- }
-
- private SourceAttributeOverrideAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, 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);
- }
-
-
- // ********** static methods **********
-
- protected static IndexedAnnotationAdapter buildAttributeOverrideAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
- return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
- }
-
- protected static IndexedDeclarationAnnotationAdapter buildAttributeOverrideDeclarationAnnotationAdapter(int index) {
- IndexedDeclarationAnnotationAdapter idaa =
- new CombinationIndexedDeclarationAnnotationAdapter(
- DECLARATION_ANNOTATION_ADAPTER,
- CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
- index,
- ANNOTATION_NAME);
- return idaa;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
deleted file mode 100644
index 463a31d15f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java
+++ /dev/null
@@ -1,293 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.jpa.core.resource.java.BaseColumnAnnotation;
-
-/**
- * <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, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- protected SourceBaseColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, 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);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseDiscriminatorColumnAnnotation.java
deleted file mode 100644
index 1ca1c80f81..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,152 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.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.resource.java.JavaResourceNode;
-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.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType;
-
-/**
- * <code>javax.persistence.DiscriminatorColumn</code>
- */
-public abstract class SourceBaseDiscriminatorColumnAnnotation
- extends SourceNamedColumnAnnotation
- implements DiscriminatorColumnAnnotation
-{
-
- private DeclarationAnnotationElementAdapter<String> discriminatorTypeDeclarationAdapter;
- private AnnotationElementAdapter<String> discriminatorTypeAdapter;
- private DiscriminatorType discriminatorType;
-
- private DeclarationAnnotationElementAdapter<Integer> lengthDeclarationAdapter;
- private AnnotationElementAdapter<Integer> lengthAdapter;
- private Integer length;
-
-
-
- protected SourceBaseDiscriminatorColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, daa, annotationAdapter);
- this.discriminatorTypeDeclarationAdapter = this.buildDiscriminatorTypeDeclarationAdapter();
- this.discriminatorTypeAdapter = this.buildDiscriminatorTypeAdapter();
- this.lengthDeclarationAdapter = this.buildLengthDeclarationAdapter();
- this.lengthAdapter = this.buildLengthAdapter();
- }
-
- protected SourceBaseDiscriminatorColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- protected SourceBaseDiscriminatorColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
- }
-
- @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));
- }
-
-
- // ********** 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 DeclarationAnnotationElementAdapter<String> buildDiscriminatorTypeDeclarationAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(this.daa, this.getDiscriminatorTypeElementName());
- }
-
- private AnnotationElementAdapter<String> buildDiscriminatorTypeAdapter() {
- return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, this.discriminatorTypeDeclarationAdapter);
- }
-
- protected abstract String getDiscriminatorTypeElementName();
-
- // ***** 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(this.getLengthElementName());
- }
-
- private AnnotationElementAdapter<Integer> buildLengthAdapter() {
- return this.buildIntegerElementAdapter(this.lengthDeclarationAdapter);
- }
-
- protected abstract String getLengthElementName();
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.discriminatorType == null) &&
- (this.length == null);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
deleted file mode 100644
index 7af43e55ba..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java
+++ /dev/null
@@ -1,94 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceNode;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.EnumType;
-import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
-
-/**
- * javax.persistence.Enumerated
- * javax.persistence.MapKeyEnumerated
- */
-public abstract class SourceBaseEnumeratedAnnotation
- extends SourceAnnotation
- implements EnumeratedAnnotation
-{
- private final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
- private final AnnotationElementAdapter<String> valueAdapter;
- private EnumType value;
-
-
- protected SourceBaseEnumeratedAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- super(parent, element, daa);
- this.valueDeclarationAdapter = new EnumDeclarationAnnotationElementAdapter(daa, getValueElementName());
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, this.valueDeclarationAdapter);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** EnumeratedAnnotation implementation **********
-
- // ***** value
- public EnumType getValue() {
- return this.value;
- }
-
- public void setValue(EnumType value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.valueAdapter.setValue(EnumType.toJavaAnnotationValue(value));
- }
- }
-
- private void syncValue(EnumType astValue) {
- EnumType old = this.value;
- this.value = astValue;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private EnumType buildValue(CompilationUnit astRoot) {
- return EnumType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.valueDeclarationAdapter, astRoot);
- }
-
- protected abstract String getValueElementName();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
deleted file mode 100644
index 8b87f97783..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java
+++ /dev/null
@@ -1,117 +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.jpa.core.internal.resource.java.source;
-
-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.resource.java.JavaResourceNode;
-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.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.BaseJoinColumnAnnotation;
-
-/**
- * <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, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, daa, annotationAdapter);
- this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
- this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
- }
-
- protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- protected SourceBaseJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, 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();
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.referencedColumnName == null);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java
deleted file mode 100644
index 336f5503e8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java
+++ /dev/null
@@ -1,296 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceNode;
-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.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-
-/**
- * <ul>
- * <li><code>javax.persistence.Table</code>
- * <li><code>javax.persistence.JoinTable</code>
- * <li><code>javax.persistence.SecondaryTable</code>
- * <li><code>javax.persistence.CollectionTable</code>
- * </ul>
- */
-public abstract class SourceBaseTableAnnotation
- extends SourceAnnotation
- 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 UniqueConstraintsAnnotationContainer uniqueConstraintsContainer = new UniqueConstraintsAnnotationContainer();
-
-
- protected SourceBaseTableAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- protected SourceBaseTableAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, 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);
- this.uniqueConstraintsContainer.initialize(this.getAstAnnotation(astRoot));
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncName(this.buildName(astRoot));
- this.syncSchema(this.buildSchema(astRoot));
- this.syncCatalog(this.buildCatalog(astRoot));
- this.uniqueConstraintsContainer.synchronize(this.getAstAnnotation(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 ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
- return this.uniqueConstraintsContainer.getNestedAnnotations();
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraintsContainer.getNestedAnnotationsSize();
- }
-
- public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraintsContainer.nestedAnnotationAt(index);
- }
-
- public UniqueConstraintAnnotation addUniqueConstraint(int index) {
- return this.uniqueConstraintsContainer.addNestedAnnotation(index);
- }
-
- private UniqueConstraintAnnotation buildUniqueConstraint(int index) {
- return new SourceUniqueConstraintAnnotation(
- this, this.annotatedElement, buildUniqueConstraintIndexedDeclarationAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildUniqueConstraintIndexedDeclarationAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(
- this.daa, this.getUniqueConstraintsElementName(), index, JPA.UNIQUE_CONSTRAINT);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.uniqueConstraintsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- }
-
- public void removeUniqueConstraint(int index) {
- this.uniqueConstraintsContainer.removeNestedAnnotation(index);
- }
-
-
- /**
- * adapt the AnnotationContainer interface to the table's unique constraints
- */
- class UniqueConstraintsAnnotationContainer
- extends AnnotationContainer<UniqueConstraintAnnotation>
- {
- @Override
- protected String getAnnotationsPropertyName() {
- return UNIQUE_CONSTRAINTS_LIST;
- }
- @Override
- protected String getElementName() {
- return SourceBaseTableAnnotation.this.getUniqueConstraintsElementName();
- }
- @Override
- protected String getNestedAnnotationName() {
- return UniqueConstraintAnnotation.ANNOTATION_NAME;
- }
- @Override
- protected UniqueConstraintAnnotation buildNestedAnnotation(int index) {
- return SourceBaseTableAnnotation.this.buildUniqueConstraint(index);
- }
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.name == null) &&
- (this.schema == null) &&
- (this.catalog == null) &&
- this.uniqueConstraintsContainer.isEmpty();
- }
-
- private AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
deleted file mode 100644
index 16a0cde56f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java
+++ /dev/null
@@ -1,95 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceNode;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.TemporalType;
-
-/**
- * Abstract implementation for JPA annotations
- * javax.persistence.Temporal
- * javax.persistence.MapKeyTemporal
- */
-public abstract class SourceBaseTemporalAnnotation
- extends SourceAnnotation
- implements TemporalAnnotation
-{
- protected final DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
- private final AnnotationElementAdapter<String> valueAdapter;
- private TemporalType value;
-
-
- protected SourceBaseTemporalAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- super(parent, element, daa);
- this.valueDeclarationAdapter = new EnumDeclarationAnnotationElementAdapter(daa, getValueElementName());
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, this.valueDeclarationAdapter);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** TemporalAnnotation implementation **********
-
- // ***** value
- public TemporalType getValue() {
- return this.value;
- }
-
- public void setValue(TemporalType value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.valueAdapter.setValue(TemporalType.toJavaAnnotationValue(value));
- }
- }
-
- private void syncValue(TemporalType astValue) {
- TemporalType old = this.value;
- this.value = astValue;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private TemporalType buildValue(CompilationUnit astRoot) {
- return TemporalType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.valueDeclarationAdapter, astRoot);
- }
-
- protected abstract String getValueElementName();
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java
deleted file mode 100644
index 16d5a2f71d..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java
+++ /dev/null
@@ -1,145 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Basic
- */
-public final class SourceBasicAnnotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.optionalAdapter = new AnnotatedElementAnnotationElementAdapter<Boolean>(element, OPTIONAL_ADAPTER);
- this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, FETCH_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.optional = this.buildOptional(astRoot);
- this.fetch = this.buildFetch(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncOptional(this.buildOptional(astRoot));
- this.syncFetch(this.buildFetch(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.optional == null) &&
- (this.fetch == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.fetch);
- }
-
-
- //*************** Basic implementation ****************
-
- // ***** optional
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean optional) {
- if (this.attributeValueHasChanged(this.optional, optional)) {
- this.optional = optional;
- this.optionalAdapter.setValue(optional);
- }
- }
-
- private void syncOptional(Boolean astOptional) {
- Boolean old = this.optional;
- this.optional = astOptional;
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, astOptional);
- }
-
- private Boolean buildOptional(CompilationUnit astRoot) {
- return this.optionalAdapter.getValue(astRoot);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot);
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- if (this.attributeValueHasChanged(this.fetch, fetch)) {
- this.fetch = fetch;
- this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
- }
- }
-
- private void syncFetch(FetchType astFetch) {
- FetchType old = this.fetch;
- this.fetch = astFetch;
- this.firePropertyChanged(FETCH_PROPERTY, old, astFetch);
- }
-
- private FetchType buildFetch(CompilationUnit astRoot) {
- return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(FETCH_ADAPTER, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__OPTIONAL, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.BASIC__FETCH);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java
deleted file mode 100644
index 8ca2e22f8a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java
+++ /dev/null
@@ -1,106 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * <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, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- super(parent, element, 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, AnnotatedElement element, DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
- return new SourceColumnAnnotation(parent, element, buildAttributeOverrideAnnotationAdapter(attributeOverrideAnnotationAdapter));
- }
-
- static DeclarationAnnotationAdapter buildAttributeOverrideAnnotationAdapter(DeclarationAnnotationAdapter attributeOverrideAnnotationAdapter) {
- return new NestedDeclarationAnnotationAdapter(attributeOverrideAnnotationAdapter, JPA.ATTRIBUTE_OVERRIDE__COLUMN, JPA.COLUMN);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
deleted file mode 100644
index c49deb0266..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java
+++ /dev/null
@@ -1,192 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation;
-
-/**
- * <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, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- super(parent, element, 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);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
deleted file mode 100644
index da10772710..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java
+++ /dev/null
@@ -1,60 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * <code>javax.persistence.DiscriminatorColumn</code>
- */
-public final class SourceDiscriminatorColumnAnnotation
- extends SourceBaseDiscriminatorColumnAnnotation
- implements DiscriminatorColumnAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceDiscriminatorColumnAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- // ********** SourceNamedColumnAnnotation implementation **********
-
- @Override
- protected String getNameElementName() {
- return JPA.DISCRIMINATOR_COLUMN__NAME;
- }
-
- @Override
- protected String getColumnDefinitionElementName() {
- return JPA.DISCRIMINATOR_COLUMN__COLUMN_DEFINITION;
- }
-
- // ********** SourceBaseDiscriminatorColumnAnnotation implementation **********
-
- @Override
- protected String getDiscriminatorTypeElementName() {
- return JPA.DISCRIMINATOR_COLUMN__DISCRIMINATOR_TYPE;
- }
-
- @Override
- protected String getLengthElementName() {
- return JPA.DISCRIMINATOR_COLUMN__LENGTH;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
deleted file mode 100644
index 3fa13799f0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java
+++ /dev/null
@@ -1,104 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.DiscriminatorValue
- */
-public final class SourceDiscriminatorValueAnnotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** DiscriminatorValueAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.valueAdapter.setValue(value);
- }
- }
-
- private void syncValue(String astValue) {
- String old = this.value;
- this.value = astValue;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.DISCRIMINATOR_VALUE__VALUE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
deleted file mode 100644
index 901cd71017..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java
+++ /dev/null
@@ -1,45 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
-
-/**
- * javax.persistence.Embeddable
- */
-public final class SourceEmbeddableAnnotation
- extends SourceAnnotation
- implements EmbeddableAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceEmbeddableAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // nothing to update
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
deleted file mode 100644
index 5981e7fa67..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java
+++ /dev/null
@@ -1,45 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
-
-/**
- * javax.persistence.Embedded
- */
-public final class SourceEmbeddedAnnotation
- extends SourceAnnotation
- implements EmbeddedAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceEmbeddedAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // nothing to update
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
deleted file mode 100644
index 013de1fcb9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java
+++ /dev/null
@@ -1,45 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
-
-/**
- * javax.persistence.EmbeddedId
- */
-public final class SourceEmbeddedIdAnnotation
- extends SourceAnnotation
- implements EmbeddedIdAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceEmbeddedIdAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // nothing to update
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java
deleted file mode 100644
index b6d30ccf97..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java
+++ /dev/null
@@ -1,111 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Entity
- */
-public final class SourceEntityAnnotation
- extends SourceAnnotation
- 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;
- TextRange nameTextRange;
-
-
- public SourceEntityAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, 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);
- this.nameTextRange = this.buildNameTextRange(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncName(this.buildName(astRoot));
- this.nameTextRange = this.buildNameTextRange(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.nameTextRange;
- }
-
- private TextRange buildNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(NAME_ADAPTER, astRoot);
- }
-
-
- //*********** static methods ****************
-
- private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ENTITY__NAME);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
deleted file mode 100644
index 65e389a38e..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java
+++ /dev/null
@@ -1,38 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Enumerated
- */
-public final class SourceEnumeratedAnnotation
- extends SourceBaseEnumeratedAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- public SourceEnumeratedAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected String getValueElementName() {
- return JPA.ENUMERATED__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
deleted file mode 100644
index 8977f5363c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java
+++ /dev/null
@@ -1,148 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.GenerationType;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.GeneratedValue
- */
-public final class SourceGeneratedValueAnnotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.strategyAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, STRATEGY_ADAPTER);
- this.generatorAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, GENERATOR_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.strategy = this.buildStrategy(astRoot);
- this.generator = this.buildGenerator(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncStrategy(this.buildStrategy(astRoot));
- this.syncGenerator(this.buildGenerator(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.strategy == null) &&
- (this.generator == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.strategy);
- }
-
-
- // ********** GeneratedValueAnnotation implementation **********
-
- // ***** strategy
- public GenerationType getStrategy() {
- return this.strategy;
- }
-
- public void setStrategy(GenerationType strategy) {
- if (this.attributeValueHasChanged(this.strategy, strategy)) {
- this.strategy = strategy;
- this.strategyAdapter.setValue(GenerationType.toJavaAnnotationValue(strategy));
- }
- }
-
- private void syncStrategy(GenerationType astStrategy) {
- GenerationType old = this.strategy;
- this.strategy = astStrategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, astStrategy);
- }
-
- private GenerationType buildStrategy(CompilationUnit astRoot) {
- return GenerationType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot));
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(STRATEGY_ADAPTER, astRoot);
- }
-
- // ***** generator
- public String getGenerator() {
- return this.generator;
- }
-
- public void setGenerator(String generator) {
- if (this.attributeValueHasChanged(this.generator, generator)) {
- this.generator = generator;
- this.generatorAdapter.setValue(generator);
- }
- }
-
- private void syncGenerator(String astGenerator) {
- String old = this.generator;
- this.generator = astGenerator;
- this.firePropertyChanged(GENERATOR_PROPERTY, old, astGenerator);
- }
-
- private String buildGenerator(CompilationUnit astRoot) {
- return this.generatorAdapter.getValue(astRoot);
- }
-
- public TextRange getGeneratorTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(GENERATOR_ADAPTER, astRoot);
- }
-
- public boolean generatorTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(GENERATOR_ADAPTER, pos, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__STRATEGY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildGeneratorAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.GENERATED_VALUE__GENERATOR);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
deleted file mode 100644
index 8a6f6bf962..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java
+++ /dev/null
@@ -1,193 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceNode;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation;
-
-/**
- * javax.persistence.SequenceGenerator
- * javax.persistence.TableGenerator
- */
-abstract class SourceGeneratorAnnotation
- extends SourceAnnotation
- implements GeneratorAnnotation
-{
- final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- final AnnotationElementAdapter<String> nameAdapter;
- String name;
- TextRange nameTextRange;
-
- final DeclarationAnnotationElementAdapter<Integer> initialValueDeclarationAdapter;
- final AnnotationElementAdapter<Integer> initialValueAdapter;
- Integer initialValue;
-
- final DeclarationAnnotationElementAdapter<Integer> allocationSizeDeclarationAdapter;
- final AnnotationElementAdapter<Integer> allocationSizeAdapter;
- Integer allocationSize;
-
-
- SourceGeneratorAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- super(parent, element, 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.nameTextRange = this.buildNameTextRange(astRoot);
- this.initialValue = this.buildInitialValue(astRoot);
- this.allocationSize = this.buildAllocationSize(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncName(this.buildName(astRoot));
- this.nameTextRange = this.buildNameTextRange(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.nameTextRange;
- }
-
- private TextRange buildNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.nameDeclarationAdapter, astRoot);
- }
-
- abstract DeclarationAnnotationElementAdapter<String> getNameAdapter();
-
- // ***** initial value
- public Integer getInitialValue() {
- return this.initialValue;
- }
-
- public void setInitialValue(Integer initialValue) {
- if (this.attributeValueHasChanged(this.initialValue, initialValue)) {
- this.initialValue = initialValue;
- this.initialValueAdapter.setValue(initialValue);
- }
- }
-
- private void syncInitialValue(Integer astIinitialValue) {
- Integer old = this.initialValue;
- this.initialValue = astIinitialValue;
- this.firePropertyChanged(INITIAL_VALUE_PROPERTY, old, astIinitialValue);
- }
-
- private Integer buildInitialValue(CompilationUnit astRoot) {
- return this.initialValueAdapter.getValue(astRoot);
- }
-
- public TextRange getInitialValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.initialValueDeclarationAdapter, astRoot);
- }
-
- abstract DeclarationAnnotationElementAdapter<Integer> getInitialValueAdapter();
-
- // ***** allocation size
- public Integer getAllocationSize() {
- return this.allocationSize;
- }
-
- public void setAllocationSize(Integer allocationSize) {
- if (this.attributeValueHasChanged(this.allocationSize, allocationSize)) {
- this.allocationSize = allocationSize;
- this.allocationSizeAdapter.setValue(allocationSize);
- }
- }
-
- private void syncAllocationSize(Integer astAllocationSize) {
- Integer old = this.allocationSize;
- this.allocationSize = astAllocationSize;
- this.firePropertyChanged(ALLOCATION_SIZE_PROPERTY, old, astAllocationSize);
- }
-
- private Integer buildAllocationSize(CompilationUnit astRoot) {
- return this.allocationSizeAdapter.getValue(astRoot);
- }
-
- public TextRange getAllocationSizeTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.allocationSizeDeclarationAdapter, astRoot);
- }
-
- abstract DeclarationAnnotationElementAdapter<Integer> getAllocationSizeAdapter();
-
-
- // ********** static methods **********
-
- static DeclarationAnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName);
- }
-
- static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Integer>(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java
deleted file mode 100644
index 411223e26b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java
+++ /dev/null
@@ -1,46 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
-
-/**
- * javax.persistence.Id
- */
-public final class SourceIdAnnotation
- extends SourceAnnotation
- implements IdAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceIdAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java
deleted file mode 100644
index ba8c2eb44a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java
+++ /dev/null
@@ -1,160 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.IdClass
- */
-public final class SourceIdClassAnnotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** IdClassAnnotation implementation **********
-
- // ***** value
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.fqClassNameStale = true;
- this.valueAdapter.setValue(value);
- }
- }
-
- private void syncValue(String astValue) {
- if (this.attributeValueHasChanged(this.value, astValue)) {
- this.syncValue_(astValue);
- }
- }
-
- private void syncValue_(String astValue) {
- String old = this.value;
- this.value = astValue;
- this.fqClassNameStale = true;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- // ***** fully-qualified class name
- public String getFullyQualifiedClassName() {
- if (this.fqClassNameStale) {
- this.fullyQualifiedClassName = this.buildFullyQualifiedClassName();
- this.fqClassNameStale = false;
- }
- return this.fullyQualifiedClassName;
- }
-
- private String buildFullyQualifiedClassName() {
- return (this.value == null) ? null : this.buildFullyQualifiedClassName_();
- }
-
- private String buildFullyQualifiedClassName_() {
- return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot()));
- }
-
-
- // ********** static methods **********
-
- protected static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return new ConversionDeclarationAnnotationElementAdapter<String>(DECLARATION_ANNOTATION_ADAPTER, JPA.ID_CLASS__VALUE, SimpleTypeStringExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java
deleted file mode 100644
index 698fc5f1b3..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java
+++ /dev/null
@@ -1,105 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.InheritanceType;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Inheritance
- */
-public final class SourceInheritanceAnnotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.strategyAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, STRATEGY_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.strategy = this.buildStrategy(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncStrategy(this.buildStrategy(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.strategy == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.strategy);
- }
-
-
- // ********** InheritanceAnnotation implementation **********
-
- // ***** strategy
- public InheritanceType getStrategy() {
- return this.strategy;
- }
-
- public void setStrategy(InheritanceType strategy) {
- if (this.attributeValueHasChanged(this.strategy, strategy)) {
- this.strategy = strategy;
- this.strategyAdapter.setValue(InheritanceType.toJavaAnnotationValue(strategy));
- }
- }
-
- private void syncStrategy(InheritanceType astStrategy) {
- InheritanceType old = this.strategy;
- this.strategy = astStrategy;
- this.firePropertyChanged(STRATEGY_PROPERTY, old, astStrategy);
- }
-
- private InheritanceType buildStrategy(CompilationUnit astRoot) {
- return InheritanceType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot));
- }
-
- public TextRange getStrategyTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(STRATEGY_ADAPTER, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildStrategyAdapter() {
- return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.INHERITANCE__STRATEGY);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
deleted file mode 100644
index 9cbe5e4144..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java
+++ /dev/null
@@ -1,147 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-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.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-
-/**
- * <code>javax.persistence.JoinColumn</code>
- */
-public final class SourceJoinColumnAnnotation
- extends SourceBaseJoinColumnAnnotation
- implements JoinColumnAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.JOIN_COLUMNS);
-
-
- public static SourceJoinColumnAnnotation buildSourceJoinColumnAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element) {
-
- return new SourceJoinColumnAnnotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public static SourceJoinColumnAnnotation buildSourceJoinColumnAnnotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement annotatedElement,
- int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildJoinColumnDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildJoinColumnAnnotationAdapter(annotatedElement, idaa);
- return new SourceJoinColumnAnnotation(
- parent,
- annotatedElement,
- idaa,
- iaa);
- }
-
-
- public static SourceJoinColumnAnnotation buildNestedSourceJoinColumnAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- return new SourceJoinColumnAnnotation(parent, element, idaa);
- }
-
- private SourceJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- private SourceJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
- }
-
- private SourceJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, daa, annotationAdapter);
- }
-
-
- 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 **********
-
- private static IndexedAnnotationAdapter buildJoinColumnAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
- return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildJoinColumnDeclarationAnnotationAdapter(int index) {
- IndexedDeclarationAnnotationAdapter idaa =
- new CombinationIndexedDeclarationAnnotationAdapter(
- DECLARATION_ANNOTATION_ADAPTER,
- CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
- index,
- ANNOTATION_NAME);
- return idaa;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java
deleted file mode 100644
index d001219ce6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java
+++ /dev/null
@@ -1,221 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
-
-/**
- * <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 JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer();
-
- private final InverseJoinColumnsAnnotationContainer inverseJoinColumnsContainer = new InverseJoinColumnsAnnotationContainer();
-
-
- public SourceJoinTableAnnotation(JavaResourceNode parent, AnnotatedElement element) {
- this(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public SourceJoinTableAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- super(parent, element, daa);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.joinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
- this.inverseJoinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.joinColumnsContainer.synchronize(this.getAstAnnotation(astRoot));
- this.inverseJoinColumnsContainer.synchronize(this.getAstAnnotation(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 ListIterable<JoinColumnAnnotation> getJoinColumns() {
- return this.joinColumnsContainer.getNestedAnnotations();
- }
-
- public int getJoinColumnsSize() {
- return this.joinColumnsContainer.getNestedAnnotationsSize();
- }
-
- public JoinColumnAnnotation joinColumnAt(int index) {
- return this.joinColumnsContainer.nestedAnnotationAt(index);
- }
-
- public JoinColumnAnnotation addJoinColumn(int index) {
- return this.joinColumnsContainer.addNestedAnnotation(index);
- }
-
- private JoinColumnAnnotation buildJoinColumn(int index) {
- return SourceJoinColumnAnnotation.buildNestedSourceJoinColumnAnnotation(
- this, this.annotatedElement, this.buildJoinColumnIndexedDeclarationAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(
- this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- public void moveJoinColumn(int targetIndex, int sourceIndex) {
- this.joinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- }
-
- public void removeJoinColumn(int index) {
- this.joinColumnsContainer.removeNestedAnnotation(index);
- }
-
- /**
- * adapt the AnnotationContainer interface to the collection table's join columns
- */
- class JoinColumnsAnnotationContainer
- extends AnnotationContainer<JoinColumnAnnotation>
- {
- @Override
- protected String getAnnotationsPropertyName() {
- return JOIN_COLUMNS_LIST;
- }
- @Override
- protected String getElementName() {
- return JPA.JOIN_TABLE__JOIN_COLUMNS;
- }
- @Override
- protected String getNestedAnnotationName() {
- return JPA.JOIN_COLUMN;
- }
- @Override
- protected JoinColumnAnnotation buildNestedAnnotation(int index) {
- return SourceJoinTableAnnotation.this.buildJoinColumn(index);
- }
- }
-
- // **************** inverse join columns *************************************************
-
- public ListIterable<JoinColumnAnnotation> getInverseJoinColumns() {
- return this.inverseJoinColumnsContainer.getNestedAnnotations();
- }
-
- public int getInverseJoinColumnsSize() {
- return this.inverseJoinColumnsContainer.getNestedAnnotationsSize();
- }
-
- public JoinColumnAnnotation inverseJoinColumnAt(int index) {
- return this.inverseJoinColumnsContainer.nestedAnnotationAt(index);
- }
-
- public JoinColumnAnnotation addInverseJoinColumn(int index) {
- return this.inverseJoinColumnsContainer.addNestedAnnotation(index);
- }
-
- private JoinColumnAnnotation buildInverseJoinColumn(int index) {
- return SourceJoinColumnAnnotation.buildNestedSourceJoinColumnAnnotation(
- this, this.annotatedElement, buildInverseJoinColumnIndexedDeclarationAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildInverseJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(
- this.daa, JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS, index, JPA.JOIN_COLUMN);
- }
-
- public void moveInverseJoinColumn(int targetIndex, int sourceIndex) {
- this.inverseJoinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- }
-
- public void removeInverseJoinColumn(int index) {
- this.inverseJoinColumnsContainer.removeNestedAnnotation(index);
- }
-
- /**
- * adapt the AnnotationContainer interface to the collection table's join columns
- */
- class InverseJoinColumnsAnnotationContainer
- extends AnnotationContainer<JoinColumnAnnotation>
- {
- @Override
- protected String getAnnotationsPropertyName() {
- return INVERSE_JOIN_COLUMNS_LIST;
- }
- @Override
- protected String getElementName() {
- return JPA.JOIN_TABLE__INVERSE_JOIN_COLUMNS;
- }
- @Override
- protected String getNestedAnnotationName() {
- return JPA.JOIN_COLUMN;
- }
- @Override
- protected JoinColumnAnnotation buildNestedAnnotation(int index) {
- return SourceJoinTableAnnotation.this.buildInverseJoinColumn(index);
- }
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.joinColumnsContainer.isEmpty() &&
- this.inverseJoinColumnsContainer.isEmpty();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java
deleted file mode 100644
index 16d82c2c63..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java
+++ /dev/null
@@ -1,46 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
-
-/**
- * javax.persistence.Lob
- */
-public final class SourceLobAnnotation
- extends SourceAnnotation
- implements LobAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceLobAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java
deleted file mode 100644
index 55aea8843a..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java
+++ /dev/null
@@ -1,141 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToMany2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.mappedBy = this.buildMappedBy(astRoot);
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.syncMappedBy(this.buildMappedBy(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.mappedBy == null);
- }
-
-
- // ********** SourceRelationshipMappingAnnotation implementation **********
-
- @Override
- DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter() {
- return TARGET_ENTITY_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getFetchAdapter() {
- return FETCH_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter() {
- return CASCADE_ADAPTER;
- }
-
-
- //**************** OwnableRelationshipMappingAnnotation implementation **************
-
- // ***** mapped by
- public String getMappedBy() {
- return this.mappedBy;
- }
-
- public void setMappedBy(String mappedBy) {
- if (this.attributeValueHasChanged(this.mappedBy, mappedBy)) {
- this.mappedBy = mappedBy;
- this.mappedByAdapter.setValue(mappedBy);
- }
- }
-
- private void syncMappedBy(String astMappedBy) {
- String old = this.mappedBy;
- this.mappedBy = astMappedBy;
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, astMappedBy);
- }
-
- private String buildMappedBy(CompilationUnit astRoot) {
- return this.mappedByAdapter.getValue(astRoot);
- }
-
- public TextRange getMappedByTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(MAPPED_BY_ADAPTER, astRoot);
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
- return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__TARGET_ENTITY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__MAPPED_BY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__FETCH);
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
- return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_MANY__CASCADE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java
deleted file mode 100644
index aa5e0e1531..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java
+++ /dev/null
@@ -1,142 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.ManyToOne2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.optional = this.buildOptional(astRoot);
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.syncOptional(this.buildOptional(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.optional == null);
- }
-
-
- // ********** SourceRelationshipMappingAnnotation implementation **********
-
- @Override
- DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter() {
- return TARGET_ENTITY_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getFetchAdapter() {
- return FETCH_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter() {
- return CASCADE_ADAPTER;
- }
-
-
- // ********** ManyToOneMappingAnnotation implementation **********
-
- // ***** optional
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean optional) {
- if (this.attributeValueHasChanged(this.optional, optional)) {
- this.optional = optional;
- this.optionalAdapter.setValue(optional);
- }
- }
-
- private void syncOptional(Boolean astOptional) {
- Boolean old = this.optional;
- this.optional = astOptional;
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, astOptional);
- }
-
- private Boolean buildOptional(CompilationUnit astRoot) {
- return this.optionalAdapter.getValue(astRoot);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
- return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__TARGET_ENTITY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__FETCH);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() {
- return buildOptionalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__OPTIONAL);
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
- return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.MANY_TO_ONE__CASCADE);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java
deleted file mode 100644
index d632caf533..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java
+++ /dev/null
@@ -1,108 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation;
-
-/**
- * javax.persistence.MapKey
- */
-public final class SourceMapKeyAnnotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.nameAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, NAME_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.name = this.buildName(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncName(this.buildName(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.name == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** MapKeyAnnotation implementation **********
-
- // ***** name
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- if (this.attributeValueHasChanged(this.name, name)) {
- this.name = name;
- this.nameAdapter.setValue(name);
- }
- }
-
- private void syncName(String astName) {
- String old = this.name;
- this.name = astName;
- this.firePropertyChanged(NAME_PROPERTY, old, astName);
- }
-
- private String buildName(CompilationUnit astRoot) {
- return this.nameAdapter.getValue(astRoot);
- }
-
- public TextRange getNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(NAME_ADAPTER, astRoot);
- }
-
- public boolean nameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(NAME_ADAPTER, pos, astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildNameAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.MAP_KEY__NAME);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
deleted file mode 100644
index 7c16a13fdc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java
+++ /dev/null
@@ -1,46 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation;
-
-/**
- * javax.persistence.MappedSuperclass
- */
-public final class SourceMappedSuperclassAnnotation
- extends SourceAnnotation
- implements MappedSuperclassAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceMappedSuperclassAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
deleted file mode 100644
index fb4bd5769b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java
+++ /dev/null
@@ -1,169 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.jpa.core.resource.java.NamedColumnAnnotation;
-
-/**
- * <code>
- * <ul>
- * <li>javax.persistence.Column
- * <li>javax.persistence.JoinColumn
- * <li>javax.persistence.DiscriminatorColumn
- * <li>javax.persistence.PrimaryKeyJoinColumn
- * <li>javax.persistence.MapKeyColumn
- * <li>javax.persistence.MapKeyJoinColumn
- * <li>javax.persistence.OrderColumn
- * </ul>
- * </code>
- */
-public abstract class SourceNamedColumnAnnotation
- extends SourceAnnotation
- 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, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- protected SourceNamedColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, 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
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
deleted file mode 100644
index ac06f765c6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java
+++ /dev/null
@@ -1,240 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools;
-import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-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.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-
-/**
- * <code>javax.persistence.NamedNativeQuery</code>
- */
-public final class SourceNamedNativeQueryAnnotation
- extends SourceQueryAnnotation
- implements NamedNativeQueryAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.NAMED_NATIVE_QUERIES);
-
- private DeclarationAnnotationElementAdapter<String> resultClassDeclarationAdapter;
- private AnnotationElementAdapter<String> resultClassAdapter;
- private String resultClass;
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
- */
- private String fullyQualifiedResultClassName;
- // we need a flag since the f-q name can be null
- private boolean fqResultClassNameStale = true;
-
- private DeclarationAnnotationElementAdapter<String> resultSetMappingDeclarationAdapter;
- private AnnotationElementAdapter<String> resultSetMappingAdapter;
- private String resultSetMapping;
-
- public static SourceNamedNativeQueryAnnotation buildSourceNamedNativeQueryAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildNamedNativeQueryDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildNamedNativeQueryAnnotationAdapter(element, idaa);
- return new SourceNamedNativeQueryAnnotation(
- parent,
- element,
- idaa,
- iaa);
- }
-
- private SourceNamedNativeQueryAnnotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter daa,
- IndexedAnnotationAdapter annotationAdapter) {
- super(parent, element, 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
- QueryHintAnnotation buildHint(int index) {
- return SourceQueryHintAnnotation.buildNamedNativeQueryQueryHint(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);
- }
-
- // ********** static methods **********
-
- private static IndexedAnnotationAdapter buildNamedNativeQueryAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
- return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNamedNativeQueryDeclarationAnnotationAdapter(int index) {
- IndexedDeclarationAnnotationAdapter idaa =
- new CombinationIndexedDeclarationAnnotationAdapter(
- DECLARATION_ANNOTATION_ADAPTER,
- CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
- index,
- ANNOTATION_NAME);
- return idaa;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
deleted file mode 100644
index 6dc5549eda..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java
+++ /dev/null
@@ -1,81 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-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.resource.java.JavaResourceNode;
-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.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-
-/**
- * <code>javax.persistence.NamedQuery</code>
- */
-public abstract class SourceNamedQueryAnnotation
- extends SourceQueryAnnotation
- implements NamedQueryAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.NAMED_QUERIES);
-
-
- protected SourceNamedQueryAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, 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
- QueryHintAnnotation buildHint(int index) {
- return SourceQueryHintAnnotation.buildNamedQueryQueryHint(this, this.annotatedElement, this.daa, index);
- }
-
- protected static IndexedAnnotationAdapter buildNamedQueryAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
- return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
- }
-
- protected static IndexedDeclarationAnnotationAdapter buildNamedQueryDeclarationAnnotationAdapter(int index) {
- IndexedDeclarationAnnotationAdapter idaa =
- new CombinationIndexedDeclarationAnnotationAdapter(
- DECLARATION_ANNOTATION_ADAPTER,
- CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
- index,
- ANNOTATION_NAME);
- return idaa;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java
deleted file mode 100644
index c2cacdba8c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java
+++ /dev/null
@@ -1,185 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToMany2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
- this.orphanRemovalAdapter = this.buildBooleanAnnotationElementAdapter(ORPHAN_REMOVAL_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.mappedBy = this.buildMappedBy(astRoot);
- this.orphanRemoval = this.buildOrphanRemoval(astRoot);
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.syncMappedBy(this.buildMappedBy(astRoot));
- this.syncOrphanRemoval(this.buildOrphanRemoval(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.mappedBy == null) &&
- (this.orphanRemoval == null);
- }
-
-
- // ********** SourceRelationshipMappingAnnotation implementation **********
-
- @Override
- DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter() {
- return TARGET_ENTITY_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getFetchAdapter() {
- return FETCH_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter() {
- return CASCADE_ADAPTER;
- }
-
-
- // ********** OwnableRelationshipMappingAnnotation implementation **********
-
- public String getMappedBy() {
- return this.mappedBy;
- }
-
- public void setMappedBy(String mappedBy) {
- if (this.attributeValueHasChanged(this.mappedBy, mappedBy)) {
- this.mappedBy = mappedBy;
- this.mappedByAdapter.setValue(mappedBy);
- }
- }
-
- private void syncMappedBy(String astMappedBy) {
- String old = this.mappedBy;
- this.mappedBy = astMappedBy;
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, astMappedBy);
- }
-
- private String buildMappedBy(CompilationUnit astRoot) {
- return this.mappedByAdapter.getValue(astRoot);
- }
-
- public TextRange getMappedByTextRange(CompilationUnit astRoot) {
- return getElementTextRange(MAPPED_BY_ADAPTER, astRoot);
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
- }
-
- // ********** OneToMany2_0Annotation implementation **********
-
- public Boolean getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- public void setOrphanRemoval(Boolean orphanRemoval) {
- if (this.attributeValueHasChanged(this.orphanRemoval, orphanRemoval)) {
- this.orphanRemoval = orphanRemoval;
- this.orphanRemovalAdapter.setValue(orphanRemoval);
- }
- }
-
- private void syncOrphanRemoval(Boolean astOrphanRemoval) {
- Boolean old = this.orphanRemoval;
- this.orphanRemoval = astOrphanRemoval;
- this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, astOrphanRemoval);
- }
-
- public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(ORPHAN_REMOVAL_ADAPTER, astRoot);
- }
-
- private Boolean buildOrphanRemoval(CompilationUnit astRoot) {
- return this.orphanRemovalAdapter.getValue(astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
- return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__TARGET_ENTITY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__MAPPED_BY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__FETCH);
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
- return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_MANY__CASCADE);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOrphanRemovalAdapter() {
- return buildOrphanRemovalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ONE_TO_MANY__ORPHAN_REMOVAL);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOrphanRemovalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java
deleted file mode 100644
index 1f5a040a23..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java
+++ /dev/null
@@ -1,227 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.OneToOne2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.mappedByAdapter = this.buildAnnotationElementAdapter(MAPPED_BY_ADAPTER);
- this.optionalAdapter = this.buildBooleanAnnotationElementAdapter(OPTIONAL_ADAPTER);
- this.orphanRemovalAdapter = this.buildBooleanAnnotationElementAdapter(ORPHAN_REMOVAL_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.mappedBy = this.buildMappedBy(astRoot);
- this.optional = this.buildOptional(astRoot);
- this.orphanRemoval = this.buildOrphanRemoval(astRoot);
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.syncMappedBy(this.buildMappedBy(astRoot));
- this.syncOptional(this.buildOptional(astRoot));
- this.syncOrphanRemoval(this.buildOrphanRemoval(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.mappedBy == null) &&
- (this.optional == null) &&
- (this.orphanRemoval == null);
- }
-
-
- // ********** SourceRelationshipMappingAnnotation implementation **********
-
- @Override
- DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter() {
- return TARGET_ENTITY_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String> getFetchAdapter() {
- return FETCH_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter() {
- return CASCADE_ADAPTER;
- }
-
-
- // ********** OneToOneAnnotation implementation **********
-
- // ***** mapped by
- public String getMappedBy() {
- return this.mappedBy;
- }
-
- public void setMappedBy(String mappedBy) {
- if (this.attributeValueHasChanged(this.mappedBy, mappedBy)) {
- this.mappedBy = mappedBy;
- this.mappedByAdapter.setValue(mappedBy);
- }
- }
-
- private void syncMappedBy(String astMappedBy) {
- String old = this.mappedBy;
- this.mappedBy = astMappedBy;
- this.firePropertyChanged(MAPPED_BY_PROPERTY, old, astMappedBy);
- }
-
- private String buildMappedBy(CompilationUnit astRoot) {
- return this.mappedByAdapter.getValue(astRoot);
- }
-
- public TextRange getMappedByTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(MAPPED_BY_ADAPTER, astRoot);
- }
-
- public boolean mappedByTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(MAPPED_BY_ADAPTER, pos, astRoot);
- }
-
- // ***** optional
- public Boolean getOptional() {
- return this.optional;
- }
-
- public void setOptional(Boolean optional) {
- if (this.attributeValueHasChanged(this.optional, optional)) {
- this.optional = optional;
- this.optionalAdapter.setValue(optional);
- }
- }
-
- private void syncOptional(Boolean astOptional) {
- Boolean old = this.optional;
- this.optional = astOptional;
- this.firePropertyChanged(OPTIONAL_PROPERTY, old, astOptional);
- }
-
- private Boolean buildOptional(CompilationUnit astRoot) {
- return this.optionalAdapter.getValue(astRoot);
- }
-
- public TextRange getOptionalTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(OPTIONAL_ADAPTER, astRoot);
- }
-
- // ********** OneToOne2_0Annotation implementation **********
-
- public Boolean getOrphanRemoval() {
- return this.orphanRemoval;
- }
-
- public void setOrphanRemoval(Boolean orphanRemoval) {
- if (this.attributeValueHasChanged(this.orphanRemoval, orphanRemoval)) {
- this.orphanRemoval = orphanRemoval;
- this.orphanRemovalAdapter.setValue(orphanRemoval);
- }
- }
-
- private void syncOrphanRemoval(Boolean astOrphanRemoval) {
- Boolean old = this.orphanRemoval;
- this.orphanRemoval = astOrphanRemoval;
- this.firePropertyChanged(ORPHAN_REMOVAL_PROPERTY, old, astOrphanRemoval);
- }
-
- public TextRange getOrphanRemovalTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(ORPHAN_REMOVAL_ADAPTER, astRoot);
- }
-
- private Boolean buildOrphanRemoval(CompilationUnit astRoot) {
- return this.orphanRemovalAdapter.getValue(astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter() {
- return buildTargetEntityAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__TARGET_ENTITY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildMappedByAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__MAPPED_BY);
- }
-
- private static DeclarationAnnotationElementAdapter<String> buildFetchAdapter() {
- return buildFetchAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__FETCH);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter() {
- return buildOptionalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__OPTIONAL);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOptionalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
- }
-
- private static DeclarationAnnotationElementAdapter<String[]> buildCascadeAdapter() {
- return buildEnumArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA.ONE_TO_ONE__CASCADE);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOrphanRemovalAdapter() {
- return buildOrphanRemovalAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ONE_TO_ONE__ORPHAN_REMOVAL);
- }
-
- private static DeclarationAnnotationElementAdapter<Boolean> buildOrphanRemovalAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new ConversionDeclarationAnnotationElementAdapter<Boolean>(annotationAdapter, elementName, BooleanExpressionConverter.instance());
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java
deleted file mode 100644
index 84d5d31dbb..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java
+++ /dev/null
@@ -1,103 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation;
-
-/**
- * javax.persistence.OrderBy
- */
-public final class SourceOrderByAnnotation
- extends SourceAnnotation
- 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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.valueAdapter = new AnnotatedElementAnnotationElementAdapter<String>(element, VALUE_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.value = this.buildValue(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncValue(this.buildValue(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.value);
- }
-
-
- // ********** OrderByAnnotation implementation **********
-
- public String getValue() {
- return this.value;
- }
-
- public void setValue(String value) {
- if (this.attributeValueHasChanged(this.value, value)) {
- this.value = value;
- this.valueAdapter.setValue(value);
- }
- }
-
- private void syncValue(String astValue) {
- String old = this.value;
- this.value = astValue;
- this.firePropertyChanged(VALUE_PROPERTY, old, astValue);
- }
-
- public TextRange getValueTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(VALUE_ADAPTER, astRoot);
- }
-
- private String buildValue(CompilationUnit astRoot) {
- return this.valueAdapter.getValue(astRoot);
- }
-
-
- // ********** static methods **********
-
- private static DeclarationAnnotationElementAdapter<String> buildValueAdapter() {
- return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA.ORDER_BY__VALUE);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java
deleted file mode 100644
index e48badcd00..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java
+++ /dev/null
@@ -1,108 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.jpa.core.resource.java.OverrideAnnotation;
-
-/**
- * <ul>
- * <li><code>javax.persistence.AttributeOverride</code>
- * <li><code>javax.persistence.AssociationOverride</code>
- * </ul>
- */
-abstract class SourceOverrideAnnotation
- extends SourceAnnotation
- implements OverrideAnnotation
-{
- DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- AnnotationElementAdapter<String> nameAdapter;
- String name;
-
-
- SourceOverrideAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, 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();
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.name == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
deleted file mode 100644
index dab305c66b..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java
+++ /dev/null
@@ -1,180 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-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.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-
-/**
- * <code>javax.persistence.PrimaryKeyJoinColumn</code>
- */
-public final class SourcePrimaryKeyJoinColumnAnnotation
- extends SourceNamedColumnAnnotation
- implements PrimaryKeyJoinColumnAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.PRIMARY_KEY_JOIN_COLUMNS);
-
- private DeclarationAnnotationElementAdapter<String> referencedColumnNameDeclarationAdapter;
- private AnnotationElementAdapter<String> referencedColumnNameAdapter;
- private String referencedColumnName;
-
- public static SourcePrimaryKeyJoinColumnAnnotation buildSourcePrimaryKeyJoinColumnAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element) {
-
- return new SourcePrimaryKeyJoinColumnAnnotation(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public static SourcePrimaryKeyJoinColumnAnnotation buildSourcePrimaryKeyJoinColumnAnnotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement element,
- int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildPrimaryKeyJoinColumnDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildPrimaryKeyJoinColumnAnnotationAdapter(element, idaa);
- return new SourcePrimaryKeyJoinColumnAnnotation(
- parent,
- element,
- idaa,
- iaa);
- }
-
- public static SourcePrimaryKeyJoinColumnAnnotation buildNestedSourcePrimaryKeyJoinColumnAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- return new SourcePrimaryKeyJoinColumnAnnotation(parent, element, idaa);
- }
-
- private SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- this(parent, element, daa, new ElementAnnotationAdapter(element, daa));
- }
-
- private SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
- this(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, idaa));
- }
-
- private SourcePrimaryKeyJoinColumnAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, daa, annotationAdapter);
- this.referencedColumnNameDeclarationAdapter = this.buildReferencedColumnNameDeclarationAdapter();
- this.referencedColumnNameAdapter = this.buildReferencedColumnNameAdapter();
- }
-
- 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);
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.referencedColumnName == null);
- }
-
- // ********** static methods **********
-
- private static IndexedAnnotationAdapter buildPrimaryKeyJoinColumnAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
- return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildPrimaryKeyJoinColumnDeclarationAnnotationAdapter(int index) {
- IndexedDeclarationAnnotationAdapter idaa =
- new CombinationIndexedDeclarationAnnotationAdapter(
- DECLARATION_ANNOTATION_ADAPTER,
- CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
- index,
- ANNOTATION_NAME);
- return idaa;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java
deleted file mode 100644
index ef31971e16..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java
+++ /dev/null
@@ -1,227 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-
-/**
- * <ul>
- * <li><code>javax.persistence.NamedQuery</code>
- * <li><code>javax.persistence.NamedNativeQuery</code>
- * </ul>
- */
-abstract class SourceQueryAnnotation
- extends SourceAnnotation
- implements QueryAnnotation
-{
- DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- AnnotationElementAdapter<String> nameAdapter;
- String name;
- TextRange nameTextRange;
-
- DeclarationAnnotationElementAdapter<String> queryDeclarationAdapter;
- AnnotationElementAdapter<String> queryAdapter;
- String query;
- TextRange queryTextRange;
-
- final QueryHintsAnnotationContainer hintsContainer = new QueryHintsAnnotationContainer();
-
-
- SourceQueryAnnotation(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
- super(parent, element, 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.nameTextRange = this.buildNameTextRange(astRoot);
- this.query = this.buildQuery(astRoot);
- this.queryTextRange = this.buildQueryTextRange(astRoot);
- this.hintsContainer.initialize(this.getAstAnnotation(astRoot));
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncName(this.buildName(astRoot));
- this.nameTextRange = this.buildNameTextRange(astRoot);
- this.syncQuery(this.buildQuery(astRoot));
- this.queryTextRange = this.buildQueryTextRange(astRoot);
- this.hintsContainer.synchronize(this.getAstAnnotation(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.nameTextRange;
- }
-
- private TextRange buildNameTextRange(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.queryTextRange;
- }
-
- private TextRange buildQueryTextRange(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 ListIterable<QueryHintAnnotation> getHints() {
- return this.hintsContainer.getNestedAnnotations();
- }
-
- public int getHintsSize() {
- return this.hintsContainer.getNestedAnnotationsSize();
- }
-
- public QueryHintAnnotation hintAt(int index) {
- return this.hintsContainer.nestedAnnotationAt(index);
- }
-
- public QueryHintAnnotation addHint(int index) {
- return this.hintsContainer.addNestedAnnotation(index);
- }
-
- public void moveHint(int targetIndex, int sourceIndex) {
- this.hintsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- }
-
- public void removeHint(int index) {
- this.hintsContainer.removeNestedAnnotation(index);
- }
-
- abstract QueryHintAnnotation buildHint(int index);
-
- abstract String getHintsElementName();
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.name == null) &&
- (this.query == null) &&
- this.hintsContainer.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** hint container **********
- /**
- * adapt the AnnotationContainer interface to the xml schema's xmlns
- */
- class QueryHintsAnnotationContainer
- extends AnnotationContainer<QueryHintAnnotation>
- {
- @Override
- protected String getAnnotationsPropertyName() {
- return HINTS_LIST;
- }
- @Override
- protected String getElementName() {
- return SourceQueryAnnotation.this.getHintsElementName();
- }
- @Override
- protected String getNestedAnnotationName() {
- return QueryHintAnnotation.ANNOTATION_NAME;
- }
- @Override
- protected QueryHintAnnotation buildNestedAnnotation(int index) {
- return SourceQueryAnnotation.this.buildHint(index);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java
deleted file mode 100644
index c50228d409..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java
+++ /dev/null
@@ -1,176 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceNode;
-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.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.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
-
-/**
- * <code>javax.persistence.QueryHint</code>
- */
-public final class SourceQueryHintAnnotation
- extends SourceAnnotation
- implements QueryHintAnnotation
-{
- private DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
- private AnnotationElementAdapter<String> nameAdapter;
- private String name;
-
- private DeclarationAnnotationElementAdapter<String> valueDeclarationAdapter;
- private AnnotationElementAdapter<String> valueAdapter;
- private String value;
-
-
- static SourceQueryHintAnnotation buildNamedQueryQueryHint(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter namedQueryAdapter, int index) {
- return buildNestedSourceQueryHintAnnotation(parent, element, buildNamedQueryQueryHintAnnotationAdapter(namedQueryAdapter, index));
- }
-
- static SourceQueryHintAnnotation buildNamedNativeQueryQueryHint(JavaResourceNode parent, AnnotatedElement element, DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
- return buildNestedSourceQueryHintAnnotation(parent, element, buildNamedNativeQueryQueryHintAnnotationAdapter(namedNativeQueryAdapter, index));
- }
-
- public static SourceQueryHintAnnotation buildNestedSourceQueryHintAnnotation(
- JavaResourceNode parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter idaa) {
-
- return new SourceQueryHintAnnotation(parent, element, idaa);
- }
-
- private SourceQueryHintAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
- super(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, 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);
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.name == null) &&
- (this.value == null);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.name);
- }
-
-
- // ********** static methods **********
- private static IndexedDeclarationAnnotationAdapter buildNamedQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedQueryAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedQueryAdapter, JPA.NAMED_QUERY__HINTS, index, ANNOTATION_NAME);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildNamedNativeQueryQueryHintAnnotationAdapter(DeclarationAnnotationAdapter namedNativeQueryAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(namedNativeQueryAdapter, JPA.NAMED_NATIVE_QUERY__HINTS, index, ANNOTATION_NAME);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
deleted file mode 100644
index 8f86b02edc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java
+++ /dev/null
@@ -1,358 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceAnnotatedElement;
-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.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.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation;
-import org.eclipse.jpt.jpa.core.resource.java.CascadeType;
-import org.eclipse.jpt.jpa.core.resource.java.FetchType;
-
-/**
- * javax.persistence.ManyToMany
- * javax.persistence.ManyToOne
- * javax.persistence.OneToMany
- * javax.persistence.OneToOne
- */
-abstract class SourceRelationshipMappingAnnotation
- extends SourceAnnotation
- implements RelationshipMapping2_0Annotation
-{
- final DeclarationAnnotationElementAdapter<String> targetEntityDeclarationAdapter;
- final AnnotationElementAdapter<String> targetEntityAdapter;
- String targetEntity;
-
- /**
- * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName
- */
- private String fullyQualifiedTargetEntityClassName;
- // we need a flag since the f-q name can be null
- private boolean fqTargetEntityClassNameStale = true;
-
- final DeclarationAnnotationElementAdapter<String> fetchDeclarationAdapter;
- final AnnotationElementAdapter<String> fetchAdapter;
- FetchType fetch;
-
- final DeclarationAnnotationElementAdapter<String[]> cascadeDeclarationAdapter;
- final AnnotationElementAdapter<String[]> cascadeAdapter;
- CascadeType[] cascadeTypes = EMPTY_CASCADE_TYPE_ARRAY; // this should never be null
- private static final CascadeType[] EMPTY_CASCADE_TYPE_ARRAY = new CascadeType[0];
-
-
- SourceRelationshipMappingAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, DeclarationAnnotationAdapter daa) {
- super(parent, element, 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[]>(element, this.cascadeDeclarationAdapter);
- }
-
- protected AnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter<String> daea) {
- return new AnnotatedElementAnnotationElementAdapter<String>(this.annotatedElement, daea);
- }
-
- protected AnnotationElementAdapter<Boolean> buildBooleanAnnotationElementAdapter(DeclarationAnnotationElementAdapter<Boolean> daea) {
- return new AnnotatedElementAnnotationElementAdapter<Boolean>(this.annotatedElement, daea);
- }
-
- public void initialize(CompilationUnit astRoot) {
- this.targetEntity = this.buildTargetEntity(astRoot);
- this.fetch = this.buildFetch(astRoot);
- this.cascadeTypes = this.buildCascadeTypes(astRoot);
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- this.syncFetch(this.buildFetch(astRoot));
- this.syncTargetEntity(this.buildTargetEntity(astRoot));
- this.syncCascadeTypes(this.buildCascadeTypes(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.targetEntity == null) &&
- (this.fetch == null) &&
- (this.cascadeTypes.length == 0);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.targetEntity);
- }
-
-
- // ********** RelationshipMappingAnnotation implementation **********
-
- // ***** target entity
- public String getTargetEntity() {
- return this.targetEntity;
- }
-
- public void setTargetEntity(String targetEntity) {
- if (this.attributeValueHasChanged(this.targetEntity, targetEntity)) {
- this.targetEntity = targetEntity;
- this.fqTargetEntityClassNameStale = true;
- this.targetEntityAdapter.setValue(targetEntity);
- }
- }
-
- private void syncTargetEntity(String astTargetEntity) {
- if (this.attributeValueHasChanged(this.targetEntity, astTargetEntity)) {
- this.syncTargetEntity_(astTargetEntity);
- }
- }
-
- private void syncTargetEntity_(String astTargetEntity) {
- String old = this.targetEntity;
- this.targetEntity = astTargetEntity;
- this.fqTargetEntityClassNameStale = true;
- this.firePropertyChanged(TARGET_ENTITY_PROPERTY, old, astTargetEntity);
- }
-
- private String buildTargetEntity(CompilationUnit astRoot) {
- return this.targetEntityAdapter.getValue(astRoot);
- }
-
- public TextRange getTargetEntityTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.targetEntityDeclarationAdapter, astRoot);
- }
-
- /**
- * return the Java adapter's 'targetEntity' element adapter config
- */
- abstract DeclarationAnnotationElementAdapter<String> getTargetEntityAdapter();
-
- // ***** fully-qualified target entity class name
- public String getFullyQualifiedTargetEntityClassName() {
- if (this.fqTargetEntityClassNameStale) {
- this.fullyQualifiedTargetEntityClassName = this.buildFullyQualifiedTargetEntityClassName();
- this.fqTargetEntityClassNameStale = false;
- }
- return this.fullyQualifiedTargetEntityClassName;
- }
-
- private String buildFullyQualifiedTargetEntityClassName() {
- return (this.targetEntity == null) ? null : this.buildFullyQualifiedTargetEntityClassName_();
- }
-
- private String buildFullyQualifiedTargetEntityClassName_() {
- return ASTTools.resolveFullyQualifiedName(this.targetEntityAdapter.getExpression(this.buildASTRoot()));
- }
-
- // ***** fetch
- public FetchType getFetch() {
- return this.fetch;
- }
-
- public void setFetch(FetchType fetch) {
- if (this.attributeValueHasChanged(this.fetch, fetch)) {
- this.fetch = fetch;
- this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch));
- }
- }
-
- private void syncFetch(FetchType astFetch) {
- FetchType old = this.fetch;
- this.fetch = astFetch;
- this.firePropertyChanged(FETCH_PROPERTY, old, astFetch);
- }
-
- private FetchType buildFetch(CompilationUnit astRoot) {
- return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot));
- }
-
- public TextRange getFetchTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(this.fetchDeclarationAdapter, astRoot);
- }
-
- /**
- * return the Java adapter's 'fetch' element adapter config
- */
- abstract DeclarationAnnotationElementAdapter<String> getFetchAdapter();
-
- // ***** cascade types
- /**
- * pre-condition: state of 'cascadeTypes' is to change
- */
- private void setCascadeType(CascadeType cascadeType, boolean set) {
- this.setCascadeTypes(set ?
- ArrayTools.add(this.cascadeTypes, cascadeType) :
- ArrayTools.remove(this.cascadeTypes, cascadeType)
- );
- }
-
- /**
- * pre-condition: state of 'cascadeTypes' is to change
- */
- private void setCascadeTypes(CascadeType[] cascadeTypes) {
- this.cascadeTypes = cascadeTypes;
- this.cascadeAdapter.setValue(CascadeType.toJavaAnnotationValues(cascadeTypes));
- }
-
- private void syncCascadeTypes(CascadeType[] astCascadeTypes) {
- CascadeType[] old = this.cascadeTypes;
- this.cascadeTypes = astCascadeTypes;
- this.syncCascadeAll(old);
- this.syncCascadeMerge(old);
- this.syncCascadePersist(old);
- this.syncCascadeRefresh(old);
- this.syncCascadeRemove(old);
- this.syncCascadeDetach(old);
- }
-
- private CascadeType[] buildCascadeTypes(CompilationUnit astRoot) {
- return CascadeType.fromJavaAnnotationValues(this.cascadeAdapter.getValue(astRoot));
- }
-
- private boolean cascadeTypeIsTrue(CascadeType cascadeType) {
- return ArrayTools.contains(this.cascadeTypes, cascadeType);
- }
-
- public TextRange getCascadeTextRange(CompilationUnit astRoot) {
- return getElementTextRange(this.cascadeDeclarationAdapter, astRoot);
- }
-
- /**
- * return the Java adapter's 'cascade' element adapter config
- */
- abstract DeclarationAnnotationElementAdapter<String[]> getCascadeAdapter();
-
- // ***** cascade all
- public boolean isCascadeAll() {
- return this.cascadeTypeIsTrue(CascadeType.ALL);
- }
-
- public void setCascadeAll(boolean cascadeAll) {
- if (this.isCascadeAll() != cascadeAll) {
- this.setCascadeType(CascadeType.ALL, cascadeAll);
- }
- }
-
- private void syncCascadeAll(CascadeType[] oldCascadeTypes) {
- boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.ALL);
- this.firePropertyChanged(CASCADE_ALL_PROPERTY, old, this.isCascadeAll());
- }
-
- // ***** cascade persist
- public boolean isCascadePersist() {
- return this.cascadeTypeIsTrue(CascadeType.PERSIST);
- }
-
- public void setCascadePersist(boolean cascadePersist) {
- if (this.isCascadePersist() != cascadePersist) {
- this.setCascadeType(CascadeType.PERSIST, cascadePersist);
- }
- }
-
- private void syncCascadePersist(CascadeType[] oldCascadeTypes) {
- boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.PERSIST);
- this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, this.isCascadePersist());
- }
-
- // ***** cascade merge
- public boolean isCascadeMerge() {
- return this.cascadeTypeIsTrue(CascadeType.MERGE);
- }
-
- public void setCascadeMerge(boolean cascadeMerge) {
- if (this.isCascadeMerge() != cascadeMerge) {
- this.setCascadeType(CascadeType.MERGE, cascadeMerge);
- }
- }
-
- private void syncCascadeMerge(CascadeType[] oldCascadeTypes) {
- boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.MERGE);
- this.firePropertyChanged(CASCADE_MERGE_PROPERTY, old, this.isCascadeMerge());
- }
-
- // ***** cascade remove
- public boolean isCascadeRemove() {
- return this.cascadeTypeIsTrue(CascadeType.REMOVE);
- }
-
- public void setCascadeRemove(boolean cascadeRemove) {
- if (this.isCascadeRemove() != cascadeRemove) {
- this.setCascadeType(CascadeType.REMOVE, cascadeRemove);
- }
- }
-
- private void syncCascadeRemove(CascadeType[] oldCascadeTypes) {
- boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.REMOVE);
- this.firePropertyChanged(CASCADE_REMOVE_PROPERTY, old, this.isCascadeRemove());
- }
-
- // ***** cascade refresh
- public boolean isCascadeRefresh() {
- return this.cascadeTypeIsTrue(CascadeType.REFRESH);
- }
-
- public void setCascadeRefresh(boolean cascadeRefresh) {
- if (this.isCascadeRefresh() != cascadeRefresh) {
- this.setCascadeType(CascadeType.REFRESH, cascadeRefresh);
- }
- }
-
- private void syncCascadeRefresh(CascadeType[] oldCascadeTypes) {
- boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.REFRESH);
- this.firePropertyChanged(CASCADE_REFRESH_PROPERTY, old, this.isCascadeRefresh());
- }
-
- // ***** cascade detach - JPA 2.0
- public boolean isCascadeDetach() {
- return this.cascadeTypeIsTrue(CascadeType.DETACH);
- }
-
- public void setCascadeDetach(boolean cascadeDetach) {
- if (this.isCascadeDetach() != cascadeDetach) {
- this.setCascadeType(CascadeType.DETACH, cascadeDetach);
- }
- }
-
- private void syncCascadeDetach(CascadeType[] oldCascadeTypes) {
- boolean old = ArrayTools.contains(oldCascadeTypes, CascadeType.DETACH);
- this.firePropertyChanged(CASCADE_DETACH_PROPERTY, old, this.isCascadeDetach());
- }
-
- // ********** static methods **********
-
- static DeclarationAnnotationElementAdapter<String> buildTargetEntityAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- // TODO what about QualifiedType?
- return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance());
- }
-
- static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter);
- }
-
- static DeclarationAnnotationElementAdapter<String> buildFetchAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new EnumDeclarationAnnotationElementAdapter(annotationAdapter, elementName);
- }
-
- static DeclarationAnnotationElementAdapter<String[]> buildEnumArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
- return new EnumArrayDeclarationAnnotationElementAdapter(annotationAdapter, elementName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
deleted file mode 100644
index d6ee3c9b34..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java
+++ /dev/null
@@ -1,185 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter;
-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.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-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.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-
-/**
- * <code>javax.persistence.SecondaryTable</code>
- */
-public final class SourceSecondaryTableAnnotation
- extends SourceBaseTableAnnotation
- implements SecondaryTableAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
- private static final DeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JPA.SECONDARY_TABLES);
-
- private final PkJoinColumnsAnnotationContainer pkJoinColumnsContainer = new PkJoinColumnsAnnotationContainer();
-
- public static SourceSecondaryTableAnnotation buildSourceSecondaryTableAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, int index) {
- IndexedDeclarationAnnotationAdapter idaa = buildSecondaryTableDeclarationAnnotationAdapter(index);
- IndexedAnnotationAdapter iaa = buildSecondaryTableAnnotationAdapter(element, idaa);
- return new SourceSecondaryTableAnnotation(
- parent,
- element,
- idaa,
- iaa);
- }
-
- private SourceSecondaryTableAnnotation(
- JavaResourceAnnotatedElement parent,
- AnnotatedElement element,
- IndexedDeclarationAnnotationAdapter daa,
- IndexedAnnotationAdapter annotationAdapter) {
- super(parent, element, daa, annotationAdapter);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.pkJoinColumnsContainer.initialize(this.getAstAnnotation(astRoot));
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.pkJoinColumnsContainer.synchronize(this.getAstAnnotation(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 ListIterable<PrimaryKeyJoinColumnAnnotation> getPkJoinColumns() {
- return this.pkJoinColumnsContainer.getNestedAnnotations();
- }
-
- public int getPkJoinColumnsSize() {
- return this.pkJoinColumnsContainer.getNestedAnnotationsSize();
- }
-
- public PrimaryKeyJoinColumnAnnotation pkJoinColumnAt(int index) {
- return this.pkJoinColumnsContainer.nestedAnnotationAt(index);
- }
-
- public PrimaryKeyJoinColumnAnnotation addPkJoinColumn(int index) {
- return this.pkJoinColumnsContainer.addNestedAnnotation(index);
- }
-
- private PrimaryKeyJoinColumnAnnotation buildPkJoinColumn(int index) {
- return SourcePrimaryKeyJoinColumnAnnotation.buildNestedSourcePrimaryKeyJoinColumnAnnotation(
- this, this.annotatedElement, this.buildPkJoinColumnIndexedDeclarationAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildPkJoinColumnIndexedDeclarationAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(
- this.daa, JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS, index, JPA.PRIMARY_KEY_JOIN_COLUMN);
- }
-
- public void movePkJoinColumn(int targetIndex, int sourceIndex) {
- this.pkJoinColumnsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- }
-
- public void removePkJoinColumn(int index) {
- this.pkJoinColumnsContainer.removeNestedAnnotation(index);
- }
-
- /**
- * adapt the AnnotationContainer interface to the collection table's join columns
- */
- class PkJoinColumnsAnnotationContainer
- extends AnnotationContainer<PrimaryKeyJoinColumnAnnotation>
- {
- @Override
- protected String getAnnotationsPropertyName() {
- return PK_JOIN_COLUMNS_LIST;
- }
- @Override
- protected String getElementName() {
- return JPA.SECONDARY_TABLE__PK_JOIN_COLUMNS;
- }
- @Override
- protected String getNestedAnnotationName() {
- return JPA.PRIMARY_KEY_JOIN_COLUMN;
- }
- @Override
- protected PrimaryKeyJoinColumnAnnotation buildNestedAnnotation(int index) {
- return SourceSecondaryTableAnnotation.this.buildPkJoinColumn(index);
- }
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.pkJoinColumnsContainer.isEmpty();
- }
-
- // ********** static methods **********
-
- private static IndexedAnnotationAdapter buildSecondaryTableAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) {
- return new ElementIndexedAnnotationAdapter(annotatedElement, idaa);
- }
-
- private static IndexedDeclarationAnnotationAdapter buildSecondaryTableDeclarationAnnotationAdapter(int index) {
- IndexedDeclarationAnnotationAdapter idaa =
- new CombinationIndexedDeclarationAnnotationAdapter(
- DECLARATION_ANNOTATION_ADAPTER,
- CONTAINER_DECLARATION_ANNOTATION_ADAPTER,
- index,
- ANNOTATION_NAME);
- return idaa;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
deleted file mode 100644
index b8027374fc..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java
+++ /dev/null
@@ -1,132 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceNode;
-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.AnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.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, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- this.sequenceNameAdapter = this.buildAdapter(SEQUENCE_NAME_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- public void initialize(CompilationUnit astRoot) {
- super.initialize(astRoot);
- this.sequenceName = this.buildSequenceName(astRoot);
- }
-
- @Override
- public void synchronizeWith(CompilationUnit astRoot) {
- super.synchronizeWith(astRoot);
- this.syncSequenceName(this.buildSequenceName(astRoot));
- }
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- (this.sequenceName == null);
- }
-
-
- // ********** AbstractGeneratorAnnotation implementation **********
-
- @Override
- DeclarationAnnotationElementAdapter<String> getNameAdapter() {
- return NAME_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<Integer> getInitialValueAdapter() {
- return INITIAL_VALUE_ADAPTER;
- }
-
- @Override
- DeclarationAnnotationElementAdapter<Integer> getAllocationSizeAdapter() {
- return ALLOCATION_SIZE_ADAPTER;
- }
-
-
- // ********** SequenceGeneratorAnnotation implementation **********
-
- // ***** sequence name
- public String getSequenceName() {
- return this.sequenceName;
- }
-
- public void setSequenceName(String sequenceName) {
- if (this.attributeValueHasChanged(this.sequenceName, sequenceName)) {
- this.sequenceName = sequenceName;
- this.sequenceNameAdapter.setValue(sequenceName);
- }
- }
-
- public void syncSequenceName(String astSequenceName) {
- String old = this.sequenceName;
- this.sequenceName = astSequenceName;
- this.firePropertyChanged(SEQUENCE_NAME_PROPERTY, old, astSequenceName);
- }
-
- private String buildSequenceName(CompilationUnit astRoot) {
- return this.sequenceNameAdapter.getValue(astRoot);
- }
-
- public TextRange getSequenceNameTextRange(CompilationUnit astRoot) {
- return this.getElementTextRange(SEQUENCE_NAME_ADAPTER, astRoot);
- }
-
- public boolean sequenceNameTouches(int pos, CompilationUnit astRoot) {
- return this.elementTouches(SEQUENCE_NAME_ADAPTER, pos, astRoot);
- }
-
-
- // ********** static methods **********
-
- protected static DeclarationAnnotationElementAdapter<String> buildAdapter(String elementName) {
- return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
- protected static DeclarationAnnotationElementAdapter<Integer> buildIntegerAdapter(String elementName) {
- return buildIntegerAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java
deleted file mode 100644
index 152305ae11..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java
+++ /dev/null
@@ -1,68 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.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(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
-
- // ********** SourceBaseTableAnnotation implementation **********
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> buildNameDeclarationAdapter() {
- return NAME_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> buildSchemaDeclarationAdapter() {
- return SCHEMA_ADAPTER;
- }
-
- @Override
- protected DeclarationAnnotationElementAdapter<String> buildCatalogDeclarationAdapter() {
- return CATALOG_ADAPTER;
- }
-
- @Override
- protected String getUniqueConstraintsElementName() {
- return JPA.TABLE__UNIQUE_CONSTRAINTS;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
deleted file mode 100644
index 2646ca81c0..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java
+++ /dev/null
@@ -1,392 +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.jpa.core.internal.resource.java.source;
-
-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.resource.java.JavaResourceNode;
-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.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.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-
-/**
- * javax.persistence.TableGenerator
- */
-public final class SourceTableGeneratorAnnotation
- extends SourceGeneratorAnnotation
- implements TableGeneratorAnnotation
-{
- public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
- private static final DeclarationAnnotationElementAdapter<String> NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__NAME);
-
- private static final DeclarationAnnotationElementAdapter<Integer> INITIAL_VALUE_ADAPTER = buildIntegerAdapter(JPA.TABLE_GENERATOR__INITIAL_VALUE);
-
- private static final DeclarationAnnotationElementAdapter<Integer> ALLOCATION_SIZE_ADAPTER = buildIntegerAdapter(JPA.TABLE_GENERATOR__ALLOCATION_SIZE);
-
- private static final DeclarationAnnotationElementAdapter<String> TABLE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__TABLE);
- private final AnnotationElementAdapter<String> tableAdapter;
- private String table;
-
- private static final DeclarationAnnotationElementAdapter<String> SCHEMA_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__SCHEMA);
- private final AnnotationElementAdapter<String> schemaAdapter;
- private String schema;
-
- private static final DeclarationAnnotationElementAdapter<String> CATALOG_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__CATALOG);
- private final AnnotationElementAdapter<String> catalogAdapter;
- private String catalog;
-
- private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_NAME);
- private final AnnotationElementAdapter<String> pkColumnNameAdapter;
- private String pkColumnName;
-
- private static final DeclarationAnnotationElementAdapter<String> VALUE_COLUMN_NAME_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__VALUE_COLUMN_NAME);
- private final AnnotationElementAdapter<String> valueColumnNameAdapter;
- private String valueColumnName;
-
- private static final DeclarationAnnotationElementAdapter<String> PK_COLUMN_VALUE_ADAPTER = buildAdapter(JPA.TABLE_GENERATOR__PK_COLUMN_VALUE);
- private final AnnotationElementAdapter<String> pkColumnValueAdapter;
- private String pkColumnValue;
-
- private final UniqueConstraintsAnnotationContainer uniqueConstraintsContainer = new UniqueConstraintsAnnotationContainer();
-
-
- public SourceTableGeneratorAnnotation(JavaResourceNode parent, AnnotatedElement element) {
- super(parent, element, 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);
- this.uniqueConstraintsContainer.initialize(this.getAstAnnotation(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));
- this.uniqueConstraintsContainer.synchronize(this.getAstAnnotation(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 ListIterable<UniqueConstraintAnnotation> getUniqueConstraints() {
- return this.uniqueConstraintsContainer.getNestedAnnotations();
- }
-
- public int getUniqueConstraintsSize() {
- return this.uniqueConstraintsContainer.getNestedAnnotationsSize();
- }
-
- public UniqueConstraintAnnotation uniqueConstraintAt(int index) {
- return this.uniqueConstraintsContainer.nestedAnnotationAt(index);
- }
-
- public UniqueConstraintAnnotation addUniqueConstraint(int index) {
- return this.uniqueConstraintsContainer.addNestedAnnotation(index);
- }
-
- private UniqueConstraintAnnotation buildUniqueConstraint(int index) {
- return new SourceUniqueConstraintAnnotation(
- this, this.annotatedElement, buildUniqueConstraintIndexedDeclarationAnnotationAdapter(index));
- }
-
- private IndexedDeclarationAnnotationAdapter buildUniqueConstraintIndexedDeclarationAnnotationAdapter(int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(
- this.daa, JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS, index, JPA.UNIQUE_CONSTRAINT);
- }
-
- public void moveUniqueConstraint(int targetIndex, int sourceIndex) {
- this.uniqueConstraintsContainer.moveNestedAnnotation(targetIndex, sourceIndex);
- }
-
- public void removeUniqueConstraint(int index) {
- this.uniqueConstraintsContainer.removeNestedAnnotation(index);
- }
-
-
- /**
- * adapt the AnnotationContainer interface to the table's unique constraints
- */
- class UniqueConstraintsAnnotationContainer
- extends AnnotationContainer<UniqueConstraintAnnotation>
- {
- @Override
- protected String getAnnotationsPropertyName() {
- return UNIQUE_CONSTRAINTS_LIST;
- }
- @Override
- protected String getElementName() {
- return JPA.TABLE_GENERATOR__UNIQUE_CONSTRAINTS;
- }
- @Override
- protected String getNestedAnnotationName() {
- return UniqueConstraintAnnotation.ANNOTATION_NAME;
- }
- @Override
- protected UniqueConstraintAnnotation buildNestedAnnotation(int index) {
- return SourceTableGeneratorAnnotation.this.buildUniqueConstraint(index);
- }
- }
-
-
-
- // ********** 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);
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java
deleted file mode 100644
index 46f411695f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java
+++ /dev/null
@@ -1,39 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-
-/**
- * javax.persistence.Temporal
- */
-public final class SourceTemporalAnnotation
- extends SourceBaseTemporalAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceTemporalAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- @Override
- protected String getValueElementName() {
- return JPA.TEMPORAL__VALUE;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java
deleted file mode 100644
index e74b9b1373..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java
+++ /dev/null
@@ -1,46 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
-
-/**
- * javax.persistence.Transient
- */
-public final class SourceTransientAnnotation
- extends SourceAnnotation
- implements TransientAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceTransientAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // nothing to update
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
deleted file mode 100644
index 9a61393c55..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java
+++ /dev/null
@@ -1,156 +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.jpa.core.internal.resource.java.source;
-
-import java.util.Arrays;
-import java.util.Vector;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-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.resource.java.JavaResourceNode;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-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.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
-import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
-
-/**
- * <code>javax.persistence.UniqueConstraint</code>
- */
-public final class SourceUniqueConstraintAnnotation
- extends SourceAnnotation
- implements UniqueConstraintAnnotation
-{
- private DeclarationAnnotationElementAdapter<String[]> columnNamesDeclarationAdapter;
- private AnnotationElementAdapter<String[]> columnNamesAdapter;
- private final Vector<String> columnNames = new Vector<String>();
-
-
- public SourceUniqueConstraintAnnotation(JavaResourceNode parent, AnnotatedElement element, IndexedDeclarationAnnotationAdapter idaa) {
- super(parent, element, idaa, new ElementIndexedAnnotationAdapter(element, 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 ListIterable<String> getColumnNames() {
- return new LiveCloneListIterable<String>(this.columnNames);
- }
-
- public int getColumnNamesSize() {
- return this.columnNames.size();
- }
-
- public String columnNameAt(int index) {
- return this.columnNames.elementAt(index);
- }
-
- 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);
- }
-
-
- // ********** misc **********
-
- @Override
- public boolean isUnset() {
- return super.isUnset() &&
- this.columnNames.isEmpty();
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append(this.columnNames);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java
deleted file mode 100644
index 39a538dab9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java
+++ /dev/null
@@ -1,45 +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.jpa.core.internal.resource.java.source;
-
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotation;
-import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
-import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
-import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation;
-
-/**
- * javax.persistence.Version
- */
-public final class SourceVersionAnnotation
- extends SourceAnnotation
- implements VersionAnnotation
-{
- private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
-
-
- public SourceVersionAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element) {
- super(parent, element, DECLARATION_ANNOTATION_ADAPTER);
- }
-
- public String getAnnotationName() {
- return ANNOTATION_NAME;
- }
-
- public void initialize(CompilationUnit astRoot) {
- // nothing to initialize
- }
-
- public void synchronizeWith(CompilationUnit astRoot) {
- // nothing to update
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java
deleted file mode 100644
index 315c4a5664..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.resource.orm;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.orm.AccessType;
-import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults;
-import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class OrmXmlResourceProvider
- extends AbstractXmlResourceProvider
- implements OrmFileCreationDataModelProperties
-{
- /**
- * (Convenience method) Returns an ORM resource model provider for
- * the given file.
- */
- public static OrmXmlResourceProvider getXmlResourceProvider(IFile file) {
- return getXmlResourceProvider_(file.getProject(), file.getFullPath());
- }
-
- /**
- * (Convenience method) Returns an ORM resource model provider for
- * the given project in the specified runtime location
- */
- public static OrmXmlResourceProvider getXmlResourceProvider(IProject project, IPath runtimePath) {
- return getXmlResourceProvider_(project, runtimePath);
- }
-
- /**
- * (Convenience method) Returns an ORM resource model provider for
- * the given project in the default runtime location
- */
- public static OrmXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
- }
-
- private static OrmXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
- return new OrmXmlResourceProvider(project, fullPath);
- }
-
-
- public OrmXmlResourceProvider(IProject project) {
- this(project, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH);
- }
-
- public OrmXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptJpaCorePlugin.ORM_XML_CONTENT_TYPE);
- }
-
- @Override
- protected void populateRoot(Object config) {
- IDataModel dataModel = (IDataModel) config;
- XmlEntityMappings entityMappings = OrmFactory.eINSTANCE.createXmlEntityMappings();
- entityMappings.setVersion(dataModel.getStringProperty(VERSION));
- getResourceContents().add(entityMappings);
-
- AccessType defaultAccess = (AccessType) dataModel.getProperty(DEFAULT_ACCESS);
- if (defaultAccess != null) {
- XmlPersistenceUnitMetadata puMetadata = OrmFactory.eINSTANCE.createXmlPersistenceUnitMetadata();
- entityMappings.setPersistenceUnitMetadata(puMetadata);
- XmlPersistenceUnitDefaults puDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults();
- puMetadata.setPersistenceUnitDefaults(puDefaults);
- puDefaults.setAccess(defaultAccess);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java
deleted file mode 100644
index 84ad7a641f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.resource.persistence;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.internal.operations.PersistenceFileCreationDataModelProperties;
-import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider;
-import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
-
-public class PersistenceXmlResourceProvider
- extends AbstractXmlResourceProvider
- implements PersistenceFileCreationDataModelProperties
-{
- /**
- * (Convenience method) Returns a persistence resource model provider for
- * the given file.
- */
- public static PersistenceXmlResourceProvider getXmlResourceProvider(IFile file) {
- return getXmlResourceProvider_(file.getProject(), file.getFullPath());
- }
-
- /**
- * (Convenience method) Returns an persistence resource model provider for
- * the given project in the specified runtime location
- */
- public static PersistenceXmlResourceProvider getXmlResourceProvider(IProject project, IPath runtimePath) {
- return getXmlResourceProvider_(project, runtimePath);
- }
-
- /**
- * (Convenience method) Returns a persistence resource model provider for
- * the given project in the default runtime location
- */
- public static PersistenceXmlResourceProvider getDefaultXmlResourceProvider(IProject project) {
- return getXmlResourceProvider(project, JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
- }
-
- private static PersistenceXmlResourceProvider getXmlResourceProvider_(IProject project, IPath fullPath) {
- return new PersistenceXmlResourceProvider(project, fullPath);
- }
-
-
- public PersistenceXmlResourceProvider(IProject project) {
- this(project, JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH);
- }
-
- public PersistenceXmlResourceProvider(IProject project, IPath filePath) {
- super(project, filePath, JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE);
- }
-
-
- @Override
- protected void populateRoot(Object config) {
- IDataModel dataModel = (IDataModel) config;
- XmlPersistence persistence = PersistenceFactory.eINSTANCE.createXmlPersistence();
- persistence.setVersion(dataModel.getStringProperty(VERSION));
- XmlPersistenceUnit persistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
- persistenceUnit.setName(getProject().getName());
- persistence.getPersistenceUnits().add(persistenceUnit);
- getResourceContents().add(persistence);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java
deleted file mode 100644
index 4ed01aa73c..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.resource.xml;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jpt.common.core.JptResourceModel;
-import org.eclipse.jpt.jpa.core.JpaFile;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-
-public class JpaXmlResourceAdapterFactory
- implements IAdapterFactory
-{
- private static final Class<?>[] ADAPTER_LIST = new Class[] { JpaXmlResource.class };
-
- public Class<?>[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
- public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) {
- if (adaptableObject instanceof IFile) {
- return this.getAdapter((IFile) adaptableObject, adapterType);
- }
- return null;
- }
-
- private Object getAdapter(final IFile file, Class <?>adapterType) {
- if (adapterType == JpaXmlResource.class) {
- JpaFile jpaFile = JptJpaCorePlugin.getJpaFile(file);
- if (jpaFile != null) {
- JptResourceModel resourceModel = jpaFile.getResourceModel();
- if (resourceModel instanceof JpaXmlResource) {
- return resourceModel;
- }
- }
- }
- return null;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java
deleted file mode 100644
index c06f2204a8..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.resource.xml;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.XmlFile;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-
-// TODO move to o.e.jpt.core.internal(.context)?
-// rename to JpaXmlPropertyTester
-public class JpaXmlResourcePropertyTester
- extends PropertyTester
-{
- public static final String IS_LATEST_SUPPORTED_VERSION = "isLatestSupportedVersion"; //$NON-NLS-1$
-
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- JpaXmlResource xmlResource = null;
- if (receiver instanceof JpaXmlResource) {
- xmlResource = (JpaXmlResource) receiver;
- }
- else if (receiver instanceof XmlFile) {
- xmlResource = ((XmlFile) receiver).getXmlResource();
- }
- else {
- return false;
- }
-
- if (IS_LATEST_SUPPORTED_VERSION.equals(property)) {
- boolean expected = ((Boolean) expectedValue).booleanValue();
- JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(xmlResource.getProject());
- IContentType contentType = xmlResource.getContentType();
- boolean actual =
- xmlResource.getVersion() != null
- && xmlResource.getVersion().equals(
- jpaProject.getJpaPlatform().getMostRecentSupportedResourceType(contentType).getVersion());
-
- return actual == expected;
- }
-
- return false;
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java
deleted file mode 100644
index cbc3693446..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java
+++ /dev/null
@@ -1,146 +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.jpa.core.internal.synch;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResourceRuleFactory;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
-import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml;
-import org.eclipse.jpt.jpa.core.internal.JptCoreMessages;
-import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource;
-
-/**
- * Synchronizes the lists of persistent classes in a persistence unit and a
- * persistence project.
- */
-public class SynchronizeClassesJob extends WorkspaceJob
-{
- private IFile persistenceXmlFile;
-
-
- public SynchronizeClassesJob(IFile file) {
- super(JptCoreMessages.SYNCHRONIZE_CLASSES_JOB);
- IResourceRuleFactory ruleFactory = ResourcesPlugin.getWorkspace().getRuleFactory();
- setRule(ruleFactory.modifyRule(file.getProject()));
- this.persistenceXmlFile = file;
- }
-
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- final SubMonitor sm = SubMonitor.convert(monitor, JptCoreMessages.SYNCHRONIZING_CLASSES_TASK, 20);
- final JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(this.persistenceXmlFile.getProject());
- final JpaXmlResource resource = jpaProject.getPersistenceXmlResource();
- if (resource == null) {
- //the resource would only be null if the persistence.xml file had an invalid content type
- return Status.OK_STATUS;
- }
- if (sm.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- sm.worked(1);
-
- resource.modify(new Runnable() {
- public void run() {
- XmlPersistence persistence = (XmlPersistence) resource.getRootObject();
- XmlPersistenceUnit persistenceUnit;
-
- if (persistence.getPersistenceUnits().size() > 0) {
- persistenceUnit = persistence.getPersistenceUnits().get(0);
- }
- else {
- persistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit();
- persistenceUnit.setName(jpaProject.getName());
- persistence.getPersistenceUnits().add(persistenceUnit);
- }
- sm.worked(1);
-
- persistenceUnit.getClasses().clear();
- sm.worked(1);
-
- addClassRefs(sm.newChild(17), jpaProject, persistenceUnit);
- }
- });
- return Status.OK_STATUS;
- }
-
- protected void addClassRefs(IProgressMonitor monitor, JpaProject jpaProject, XmlPersistenceUnit persistenceUnit) {
- Iterable<String> mappedClassNames = getMappedClassNames(jpaProject, '$');
- final SubMonitor sm = SubMonitor.convert(monitor, CollectionTools.size(mappedClassNames));
-
- for (String fullyQualifiedTypeName : mappedClassNames) {
- if ( ! mappingFileContains(jpaProject, fullyQualifiedTypeName)) {
- XmlJavaClassRef classRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef();
- classRef.setJavaClass(fullyQualifiedTypeName);
- persistenceUnit.getClasses().add(classRef);
- }
- sm.worked(1);
- }
- }
-
- protected Iterable<String> getMappedClassNames(final JpaProject jpaProject, final char enclosingTypeSeparator) {
- return new TransformationIterable<String, String>(jpaProject.getMappedJavaSourceClassNames()) {
- @Override
- protected String transform(String fullyQualifiedName) {
- IType jdtType = SynchronizeClassesJob.this.findType(jpaProject, fullyQualifiedName);
- return jdtType.getFullyQualifiedName(enclosingTypeSeparator);
- }
- };
- }
-
- protected IType findType(JpaProject jpaProject, String typeName) {
- try {
- return jpaProject.getJavaProject().findType(typeName);
- } catch (JavaModelException ex) {
- return null; // ignore exception?
- }
- }
-
- boolean mappingFileContains(JpaProject jpaProject, String fullyQualifiedTypeName) {
- PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml();
- if (persistenceXml == null) {
- return false;
- }
- Persistence persistence = persistenceXml.getPersistence();
- if (persistence == null) {
- return false;
- }
- if (persistence.getPersistenceUnitsSize() == 0) {
- return false;
- }
- PersistenceUnit persistenceUnit = persistence.getPersistenceUnits().iterator().next();
- for (MappingFileRef mappingFileRef : persistenceUnit.getMappingFileRefs()) {
- if (mappingFileRef.getPersistentType(fullyQualifiedTypeName) != null) {
- return true;
- }
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java
deleted file mode 100644
index 0acb9697d9..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.validation;
-
-import org.eclipse.jpt.common.core.utility.TextRange;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.wst.validation.internal.core.Message;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class DefaultJpaValidationMessages {
-
- private static String[] DEFAULT_PARMS = new String[0];
- private static TextRange DEFAULT_TEXT_RANGE = TextRange.Empty.instance();
-
- public static IMessage buildMessage(
- int defaultSeverity, String messageId, Object targetObject) {
- return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject);
- }
-
- public static IMessage buildMessage(
- int defaultSeverity, String messageId, String[] parms, Object targetObject) {
- return buildMessage(defaultSeverity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE);
- }
-
- public static IMessage buildMessage(
- int defaultSeverity, String messageId, Object targetObject, TextRange textRange) {
- return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject, textRange);
- }
-
- public static IMessage buildMessage(
- int defaultSeverity, String messageId, String[] parms, Object targetObject, TextRange textRange) {
-
- //determine whether default severity should be overridden
- int severity = defaultSeverity;
- int severityPreference = JpaValidationPreferences.getProblemSeverityPreference(targetObject, messageId);
- if (severityPreference!=JpaValidationPreferences.NO_SEVERITY_PREFERENCE){
- severity = severityPreference;
- }
- IMessage message = new Message(JpaValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject);
- message.setMarkerId(JptJpaCorePlugin.VALIDATION_MARKER_ID);
- if (textRange == null) {
- //log an exception and then continue without setting location information
- //At least the user will still get the validation message and will
- //be able to see other validation messages with valid textRanges
- JptJpaCorePlugin.log(new NullPointerException("Null text range for message ID: " + messageId)); //$NON-NLS-1$
- }
- else {
- message.setLineNo(textRange.getLineNumber());
- message.setOffset(textRange.getOffset());
- message.setLength(textRange.getLength());
- }
- return message;
- }
-
-
- private DefaultJpaValidationMessages() {
- super();
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaHelper.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaHelper.java
deleted file mode 100644
index df5ffa2b51..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.validation;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jpt.jpa.core.JpaNode;
-
-public class JpaHelper extends org.eclipse.wst.validation.internal.operations.WorkbenchContext {
-
- @Override
- public IResource getResource(Object obj) {
- return ((JpaNode) obj).getResource();
- }
-
- /*
- * This is used when no line number is set. We generally use line numbers.
- * Therefore, when this is called, we will use the default location, i.e.
- * null.
- */
- @Override
- public String getLocation(Object object) {
- return null;
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationDescriptionMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationDescriptionMessages.java
deleted file mode 100644
index 2b1df175a7..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.validation;
-
-import org.eclipse.osgi.util.NLS;
-
-public class JpaValidationDescriptionMessages {
-
- public static String DOES_NOT_MATCH_JOIN_TABLE;
- public static String DOES_NOT_MATCH_COLLECTION_TABLE;
- public static String NOT_VALID_FOR_THIS_ENTITY;
-
- public static String ATTRIBUTE_DESC;
- public static String VIRTUAL_ATTRIBUTE_DESC;
-
- public static String ON_MAPPED_SUPERCLASS;
- public static String ON_EMBEDDABLE;
-
-
- private static final String BUNDLE_NAME = "jpa_validation_description"; //$NON-NLS-1$
- private static final Class<?> BUNDLE_CLASS = JpaValidationDescriptionMessages.class;
- static {
- NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS);
- }
-
- private JpaValidationDescriptionMessages() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java
deleted file mode 100644
index 3ae7907e20..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2011 Oracle. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0, which accompanies this distribution
- * and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Contributors:
- * Oracle - initial API and implementation
- ******************************************************************************/
-package org.eclipse.jpt.jpa.core.internal.validation;
-
-@SuppressWarnings("nls")
-// TODO bjv rename to JptJpaValidationMessages
-public interface JpaValidationMessages {
-
- public static final String BUNDLE_NAME = "jpa_validation";
-
- //Content is organized based on the categories and entries in each categories are listed alphabetically.
- //If adding a new entry, please be sure to add it to the corresponding category at the right place.
-
- //Project
- public static final String NO_JPA_PROJECT = "NO_JPA_PROJECT";
- public static final String PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS = "PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS";
- public static final String PERSISTENCE_NO_PERSISTENCE_UNIT = "PERSISTENCE_NO_PERSISTENCE_UNIT";
- 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 PROJECT_INACTIVE_CONNECTION = "PROJECT_INACTIVE_CONNECTION";
- public static final String PROJECT_INVALID_CONNECTION = "PROJECT_INVALID_CONNECTION";
- public static final String PROJECT_INVALID_LIBRARY_PROVIDER = "PROJECT_INVALID_LIBRARY_PROVIDER";
- public static final String PROJECT_MULTIPLE_PERSISTENCE_XML = "PROJECT_MULTIPLE_PERSISTENCE_XML";
- public static final String PROJECT_NO_CONNECTION = "PROJECT_NO_CONNECTION";
- public static final String PROJECT_NO_PERSISTENCE_XML = "PROJECT_NO_PERSISTENCE_XML";
- public static final String XML_VERSION_NOT_LATEST = "XML_VERSION_NOT_LATEST";
-
- //Persistence Unit
- public static final String MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA = "MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA";
- public static final String PERSISTENT_TYPE_DUPLICATE_CLASS = "PERSISTENT_TYPE_DUPLICATE_CLASS";
- public static final String PERSISTENCE_UNIT_DUPLICATE_CLASS = "PERSISTENCE_UNIT_DUPLICATE_CLASS";
- public static final String PERSISTENCE_UNIT_DUPLICATE_JAR_FILE = "PERSISTENCE_UNIT_DUPLICATE_JAR_FILE";
- public static final String PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE = "PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE";
- public static final String PERSISTENCE_UNIT_INVALID_CLASS = "PERSISTENCE_UNIT_INVALID_CLASS";
- public static final String PERSISTENCE_UNIT_INVALID_MAPPING_FILE = "PERSISTENCE_UNIT_INVALID_MAPPING_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_CLASS = "PERSISTENCE_UNIT_NONEXISTENT_CLASS";
- public static final String PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE = "PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE";
- public static final String PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE = "PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE";
- public static final String PERSISTENCE_UNIT_REDUNDANT_CLASS = "PERSISTENCE_UNIT_REDUNDANT_CLASS";
- public static final String PERSISTENCE_UNIT_UNSPECIFIED_CLASS = "PERSISTENCE_UNIT_UNSPECIFIED_CLASS";
- public static final String PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE = "PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE";
- 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";
-
- //Type
- public static final String ENTITY_NAME_DUPLICATED = "ENTITY_NAME_DUPLICATED";
- public static final String ENTITY_NAME_MISSING = "ENTITY_NAME_MISSING";
- public static final String ENTITY_NO_PK = "ENTITY_NO_PK";
- public static final String ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED = "ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED";
- public static final String ENTITY_NON_ROOT_ID_CLASS_SPECIFIED = "ENTITY_NON_ROOT_ID_CLASS_SPECIFIED";
- 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_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT = "PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT";
- public static final String PERSISTENT_TYPE_UNRESOLVED_CLASS = "PERSISTENT_TYPE_UNRESOLVED_CLASS";
- public static final String PERSISTENT_TYPE_UNSPECIFIED_CLASS = "PERSISTENT_TYPE_UNSPECIFIED_CLASS";
- public static final String TARGET_NOT_AN_EMBEDDABLE = "TARGET_NOT_AN_EMBEDDABLE";
- 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 TYPE_MAPPING_FINAL_CLASS = "TYPE_MAPPING_FINAL_CLASS";
- 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_ID_CLASS_ATTRIBUTE_MAPPING_DUPLICATE_MATCH = "TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_DUPLICATE_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_NO_MATCH = "TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NO_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 TYPE_MAPPING_ID_CLASS_NAME_EMPTY = "TYPE_MAPPING_ID_CLASS_NAME_EMPTY";
- public static final String TYPE_MAPPING_ID_CLASS_NOT_EXIST = "TYPE_MAPPING_ID_CLASS_NOT_EXIST";
- public static final String TYPE_MAPPING_ID_CLASS_NOT_VALID = "TYPE_MAPPING_ID_CLASS_NOT_VALID";
- 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_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_MEMBER_CLASS = "TYPE_MAPPING_MEMBER_CLASS";
- public static final String TYPE_MAPPING_MULTIPLE_EMBEDDED_ID = "TYPE_MAPPING_MULTIPLE_EMBEDDED_ID";
- public static final String TYPE_MAPPING_PK_REDEFINED_ID_ATTRIBUTE = "TYPE_MAPPING_PK_REDEFINED_ID_ATTRIBUTE";
- public static final String TYPE_MAPPING_PK_REDEFINED_ID_CLASS = "TYPE_MAPPING_PK_REDEFINED_ID_CLASS";
-
- //Attribute
- public static final String ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED = "ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED";
- public static final String ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST = "ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST";
- 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 ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED = "ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED";
- 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 ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED = "ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED";
- public static final String MAPS_ID_VALUE_INVALID = "MAPS_ID_VALUE_INVALID";
- public static final String MAPS_ID_VALUE_NOT_RESOLVED = "MAPS_ID_VALUE_NOT_RESOLVED";
- public static final String MAPS_ID_VALUE_NOT_SPECIFIED = "MAPS_ID_VALUE_NOT_SPECIFIED";
- 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 MAPPING_UNRESOLVED_MAPPED_BY = "MAPPING_UNRESOLVED_MAPPED_BY";
- public static final String ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED = "ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED";
- public static final String PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE = "PERSISTENT_ATTRIBUTE_ELEMENT_COLLECTION_INVALID_VALUE_TYPE";
- 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_FINAL_SETTER = "PERSISTENT_ATTRIBUTE_FINAL_SETTER";
- public static final String PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED = "PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED";
- public static final String PERSISTENT_ATTRIBUTE_INVALID_MAPPING = "PERSISTENT_ATTRIBUTE_INVALID_MAPPING";
- public static final String PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE = "PERSISTENT_ATTRIBUTE_INVALID_TEMPORAL_MAPPING_TYPE";
- public static final String PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE = "PERSISTENT_ATTRIBUTE_INVALID_VERSION_MAPPING_TYPE";
- public static final String PERSISTENT_ATTRIBUTE_PUBLIC_FIELD = "PERSISTENT_ATTRIBUTE_PUBLIC_FIELD";
- public static final String PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME = "PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME";
- public static final String PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME = "PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME";
- public static final String TARGET_ENTITY_IS_NOT_AN_ENTITY = "TARGET_ENTITY_IS_NOT_AN_ENTITY";
- public static final String TARGET_ENTITY_NOT_DEFINED = "TARGET_ENTITY_NOT_DEFINED";
- //***Implied Attribute***
- 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 VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST";
- 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 VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED";
- public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY";
- public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED";
-
- //Table
- public static final String COLLECTION_TABLE_UNRESOLVED_CATALOG = "COLLECTION_TABLE_UNRESOLVED_CATALOG";
- public static final String COLLECTION_TABLE_UNRESOLVED_NAME = "COLLECTION_TABLE_UNRESOLVED_NAME";
- public static final String COLLECTION_TABLE_UNRESOLVED_SCHEMA = "COLLECTION_TABLE_UNRESOLVED_SCHEMA";
- public static final String JOIN_TABLE_UNRESOLVED_CATALOG = "JOIN_TABLE_UNRESOLVED_CATALOG";
- public static final String JOIN_TABLE_UNRESOLVED_NAME = "JOIN_TABLE_UNRESOLVED_NAME";
- public static final String JOIN_TABLE_UNRESOLVED_SCHEMA = "JOIN_TABLE_UNRESOLVED_SCHEMA";
- public static final String SECONDARY_TABLE_UNRESOLVED_CATALOG = "SECONDARY_TABLE_UNRESOLVED_CATALOG";
- public static final String SECONDARY_TABLE_UNRESOLVED_NAME = "SECONDARY_TABLE_UNRESOLVED_NAME";
- public static final String SECONDARY_TABLE_UNRESOLVED_SCHEMA = "SECONDARY_TABLE_UNRESOLVED_SCHEMA";
- public static final String TABLE_UNRESOLVED_CATALOG = "TABLE_UNRESOLVED_CATALOG";
- public static final String TABLE_UNRESOLVED_NAME = "TABLE_UNRESOLVED_NAME";
- public static final String TABLE_UNRESOLVED_SCHEMA = "TABLE_UNRESOLVED_SCHEMA";
- //***Implied Attribute***
- 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_NAME = "VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ATTRIBUTE_COLLECTION_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_NAME = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA";
-
- //Column
- public static final String COLUMN_TABLE_NOT_VALID="COLUMN_TABLE_NOT_VALID";
- public static final String COLUMN_UNRESOLVED_NAME = "COLUMN_UNRESOLVED_NAME";
- public static final String COLUMN_UNRESOLVED_TABLE = "COLUMN_UNRESOLVED_TABLE";
- 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 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 INVERSE_JOIN_COLUMN_TABLE_NOT_VALID = "INVERSE_JOIN_COLUMN_TABLE_NOT_VALID";
- public static final String INVERSE_JOIN_COLUMN_UNRESOLVED_NAME = "INVERSE_JOIN_COLUMN_UNRESOLVED_NAME";
- public static final String INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_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 JOIN_COLUMN_TABLE_NOT_VALID = "JOIN_COLUMN_TABLE_NOT_VALID";
- 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 JOIN_COLUMN_UNRESOLVED_NAME = "JOIN_COLUMN_UNRESOLVED_NAME";
- public static final String JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
- public static final String MAP_KEY_COLUMN_TABLE_NOT_VALID="MAP_KEY_COLUMN_TABLE_NOT_VALID";
- public static final String MAP_KEY_COLUMN_UNRESOLVED_NAME="MAP_KEY_COLUMN_UNRESOLVED_NAME";
- public static final String ORDER_COLUMN_UNRESOLVED_NAME = "ORDER_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_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 PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME";
- public static final String PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME";
-
- // virtual attribute
- public static final String VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID";
- 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_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID";
- 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_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_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 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_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID";
- public static final String VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME";
- 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_UNRESOLVED_TABLE = "VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_TABLE";
- public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID";
- public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME="VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_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_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_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 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_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_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";
-
- //Overrides
- public static final String ASSOCIATION_OVERRIDE_INVALID_NAME = "ASSOCIATION_OVERRIDE_INVALID_NAME";
- public static final String ATTRIBUTE_OVERRIDE_INVALID_NAME = "ATTRIBUTE_OVERRIDE_INVALID_NAME";
- public static final String ATTRIBUTE_OVERRIDE_INVALID_TYPE = "ATTRIBUTE_OVERRIDE_INVALID_TYPE";
- public static final String ATTRIBUTE_OVERRIDE_DERIVED_AND_SPECIFIED = "ATTRIBUTE_OVERRIDE_DERIVED_AND_SPECIFIED";
- public static final String VIRTUAL_ASSOCIATION_OVERRIDE_INVALID_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_INVALID_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_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID";
- public static final String VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME";
- 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_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_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID";
- 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_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_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_NAME = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME";
- public static final String VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA = "VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA";
- public static final String VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVALID_NAME = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVALID_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_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_TABLE_NOT_VALID = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID";
- 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_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_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_TABLE_NOT_VALID = "VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID";
- 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_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
- public static final String VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME = "VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME";
- 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 VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_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 VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID="VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID";
- public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_NAME = "VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_NAME";
- public static final String VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_TYPE = "VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_TYPE";
- 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_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME = "VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME";
- public static final String VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME = "VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME";
-
- //Inheritance
- public static final String DISCRIMINATOR_COLUMN_UNRESOLVED_NAME = "DISCRIMINATOR_COLUMN_UNRESOLVED_NAME";
- public static final String ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED = "ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED";
- public static final String ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE = "ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE";
- public static final String ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED = "ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED";
- public static final String ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE = "ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE";
- public static final String ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED = "ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED";
- public static final String ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED = "ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED";
- public static final String ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM";
- public static final String ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM = "ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM";
-
- //Generator
- public static final String GENERATOR_DUPLICATE_NAME = "GENERATOR_DUPLICATE_NAME";
- public static final String GENERATOR_NAME_UNDEFINED = "GENERATOR_NAME_UNDEFINED";
- public static final String ID_MAPPING_UNRESOLVED_GENERATOR_NAME = "ID_MAPPING_UNRESOLVED_GENERATOR_NAME";
-
- //Query
- public static final String JPQL_QUERY_VALIDATION = "JPQL_QUERY_VALIDATION";
- 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";
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java
deleted file mode 100644
index 45b7fa7697..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/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.jpa.core.internal.validation;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.jpt.common.core.IResourcePart;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.osgi.service.prefs.BackingStoreException;
-
-//TODO: Probably want to merge the behavior in this class into JptJpaCorePlugin
-public class JpaValidationPreferences {
-
- /*
- * prefix for all preference strings. This is only used internally.
- * Clients of get*LevelProblemPrefernce() and set*LevelProblemPreference
- * should not include the prefix.
- */
- private static final String PROBLEM_PREFIX = "problem."; //$NON-NLS-1$
-
- public static final String ERROR = "error"; //$NON-NLS-1$
- public static final String WARNING = "warning"; //$NON-NLS-1$
- public static final String INFO = "info"; //$NON-NLS-1$
- public static final String IGNORE = "ignore"; //$NON-NLS-1$
-
- static final int NO_SEVERITY_PREFERENCE = -1;
-
- public static final String WORKSPACE_PREFERENCES_OVERRIDEN = "workspace_preferences_overriden"; //$NON-NLS-1$
-
- /**
- * Returns only the severity level of a given problem preference. This does not
- * include information on whether the problem is ignored. See isProblemIgnored.
- * @return an IMessage severity level
- */
- public static int getProblemSeverityPreference(Object targetObject, String messageId) {
- IProject project = getProject(targetObject);
- String problemPreference = getPreference(project, messageId);
-
- if (problemPreference == null){
- return NO_SEVERITY_PREFERENCE;
- } else if (problemPreference.equals(ERROR)){
- return IMessage.HIGH_SEVERITY;
- } else if (problemPreference.equals(WARNING)){
- return IMessage.NORMAL_SEVERITY;
- } else if (problemPreference.equals(INFO)){
- return IMessage.LOW_SEVERITY;
- }
- return NO_SEVERITY_PREFERENCE;
- }
-
- private static IProject getProject(Object targetObject) {
- IAdaptable target = (IAdaptable)targetObject;
- IResource resource = ((IResourcePart) target.getAdapter(IResourcePart.class)).getResource();
- IProject project = resource.getProject();
- return project;
- }
-
- /**
- * Returns whether or not this problem should be ignored based on project or
- * workspace preferences
- */
- public static boolean isProblemIgnored(IProject project, String messageId){
- String problemPreference = getPreference(project, messageId);
- if (problemPreference != null && problemPreference.equals(IGNORE)){
- return true;
- }
- return false;
- }
-
- private static String getPreference(IProject project, String messageId) {
- String problemPreference = null;
- problemPreference = getProjectLevelProblemPreference(project, messageId);
- //if severity is still null, check the workspace preferences
- if (problemPreference == null) {
- problemPreference = getWorkspaceLevelProblemPreference(messageId);
- }
- return problemPreference;
- }
-
- /**
- * Returns the String value of the problem preference from the project preferences
- */
- public static String getProjectLevelProblemPreference(IProject project, String messageId){
- return getPreference(JptJpaCorePlugin.getProjectPreferences(project), messageId);
- }
-
- public static void setProjectLevelProblemPreference(IProject project, String messageId, String problemPreference) {
- IEclipsePreferences projectPreferences = JptJpaCorePlugin.getProjectPreferences(project);
- setPreference(projectPreferences, messageId, problemPreference);
- flush(projectPreferences);
- }
-
- /**
- * Returns the String value of the problem preference from the workspace preferences
- */
- public static String getWorkspaceLevelProblemPreference(String messageId){
- return getPreference(JptJpaCorePlugin.getWorkspacePreferences(), messageId);
- }
-
- public static void setWorkspaceLevelProblemPreference(String messageId, String problemPreference) {
- IEclipsePreferences workspacePreferences = JptJpaCorePlugin.getWorkspacePreferences();
- setPreference(workspacePreferences, messageId, problemPreference);
- flush(workspacePreferences);
- }
-
- private static String getPreference(IEclipsePreferences preferences, String messageId) {
- return preferences.get(appendProblemPrefix(messageId), null);
- }
-
- private static void setPreference(IEclipsePreferences preferences, String messageId, String problemPreference) {
- if (problemPreference == null){
- preferences.remove(appendProblemPrefix(messageId));
- }
- else {
- preferences.put(appendProblemPrefix(messageId), problemPreference);
- }
- }
-
- private static String appendProblemPrefix(String messageId) {
- return PROBLEM_PREFIX + messageId;
- }
-
- public static void flush(IEclipsePreferences prefs) {
- try {
- prefs.flush();
- } catch(BackingStoreException ex) {
- JptJpaCorePlugin.log(ex);
- }
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java
deleted file mode 100644
index ec844cf87f..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java
+++ /dev/null
@@ -1,121 +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.jpa.core.internal.validation;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jpt.common.core.IResourcePart;
-import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable;
-import org.eclipse.jpt.jpa.core.JpaProject;
-import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
-import org.eclipse.wst.validation.AbstractValidator;
-import org.eclipse.wst.validation.ValidationResult;
-import org.eclipse.wst.validation.ValidationState;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IProjectValidationContext;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
-import org.eclipse.wst.validation.internal.provisional.core.IValidator;
-
-/**
- * This class is referenced in the JPA extension for the
- * WTP validator extension point.
- */
-public class JpaValidator extends AbstractValidator implements IValidator {
-
- public JpaValidator() {
- super();
- }
-
-
- // ********** IValidator implementation **********
-
- public void validate(IValidationContext context, IReporter reporter) {
- validate(reporter, project(context));
- }
-
- public void cleanup(IReporter reporter) {
- // nothing to do
- }
-
-
- // **************** AbstractValidator impl *********************************
-
- @Override
- public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
- if (resource.getType() != IResource.FILE)
- return null;
- ValidationResult result = new ValidationResult();
- IReporter reporter = result.getReporter(monitor);
- IProject project = resource.getProject();
- this.clearMarkers(project);
- result.setSuspendValidation(project);
- this.validate(reporter, project);
- return result;
- }
-
-
- // **************** internal conv. *****************************************
- private void clearMarkers(IProject project) {
- try {
- clearMarkers_(project);
- }
- catch (CoreException ce) {
- JptJpaCorePlugin.log(ce);
- }
- }
-
- private void clearMarkers_(IProject project) throws CoreException {
- IMarker[] markers = project.findMarkers(JptJpaCorePlugin.VALIDATION_MARKER_ID, true, IResource.DEPTH_INFINITE);
- for (IMarker marker : markers) {
- marker.delete();
- }
- }
-
- private void validate(IReporter reporter, IProject project) {
- for (IMessage message : this.getValidationMessages(reporter, project)) {
- // check to see if the message should be ignored based on preferences
- if (!JpaValidationPreferences.isProblemIgnored(project, message.getId())){
- reporter.addMessage(this, adjustMessage(message));
- }
- }
- }
-
- private IProject project(IValidationContext context) {
- return ((IProjectValidationContext) context).getProject();
- }
-
- private Iterable<IMessage> getValidationMessages(IReporter reporter, IProject project) {
- JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project);
- if (jpaProject != null) {
- return jpaProject.getValidationMessages(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